Application Scenarios:
A page that needs to be refreshed periodically, and a variety of things that need to be displayed after an AJAX update.
Implementation method
How many methods can be implemented, such as:
History.go (0) window.location.reload () Window.location.reload (True) location=locationlocation.assign (location) Document.execcommand ("Refresh") window.navigate (location), Location.replace (location) document. Url=location.href
With compatibility in mind, you'll probably end up with statements
Window.location = window.location
Under the Get method access, this method is usually reloaded in the local cache, so there is a way to add a random number to the address to allow the browser to request the server address again.
The code is as follows
function reloadlocation () { var t = new String (window.location); if (T.indexof (' r= ') > 0) { t = t.replace (/r=[0123456789\.] +/gi, ' r= ' + math.random ()); } else { if (t.indexof ('? ') > 0) { t = t + ' &r= ' + math.random () } else { T = t + '? r= ' + math.random (); } } window.location = t; }
Notice of Use
This method consumes the URL R parameter, and please pay more attention to
If you have a better way, please let us know.
Common scripts: Reload, refresh, current, self page