-1

Is there a jQuery method to reload the page that will work in all browsers and cause the page to be reloaded from the server?

My intranet users leave their browsers open often for weeks on end, and when I make a fix or change to a javascript file that is referenced in the page's < head > section, I want the page to be reloaded and to get the latest version of that javascript file.

My plan was to keep a record in a database on the server and poll the database periodically via ajax in order to determine if the relevant timestamp in the database is more recent than the datetime the page was loaded, and if so, force the page to reload.

See: Force a reload of page in Chrome using Javascript [no cache]

4

2 回答 2

7

No jQuery required, just plain old JavaScript

window.location.reload()
于 2013-02-08T14:23:20.360 回答
1
window.location.reload(true)

是一个更好的选择,因为它会清除缓存

于 2013-02-08T14:25:10.537 回答