gpt4 book ai didi

javascript - window.location.reload() 还是 location.reload() 更好?

转载 作者:行者123 更新时间:2023-12-02 14:34:02 26 4
gpt4 key购买 nike

我需要使用 JavaScript 刷新页面。我尝试了 window.location.reload()location.reload()。两者都在工作并重新加载页面。我应该使用哪一个?

最佳答案

The Location interface represents the location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively.

https://developer.mozilla.org/en-US/docs/Web/API/Location

所以...它们是同一件事:)

关于javascript - window.location.reload() 还是 location.reload() 更好?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37604482/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com