Randy said:
Thomas 'PointedEars' Lahn said the following on 1/12/2008 4:35 PM:
Randy Webb wrote:
Doug Gunnoe said the following on 1/12/2008 8:28 AM:
I want to put a link on my web pages to allow the user to click and
refresh the page.
I have seen twqo ways to do this:-
<a href="javascript:location.reload(true)">
<a href="javascript:history.go(0)">
Both are junk.
[...]
you could also try
window.location.href = window.location.href
...href + "?" + new Date().getTime()
might get you a better reload from the server. Reloading from the cache
is a waste of time.
That is why the `reload' method of Location objects accept `true'
for its first argument which avoids any of the other dirty hacks.
And then you have to hope that the browser, for whatever reason, honors
it.
The reason would be that this feature is part of DOM Level 0 which so far
is "honored" by every scriptable HTML user agent due to backwards
compatibility. It is available in JavaScript 1.1 to 1.3 (NN 3+), moved
from there with v1.5 to the Gecko DOM; it is available in the MSHTML DOM
since at least version 4, incorporated in the Opera DOM, the KHTML DOM,
and (consequently) Apple WebCore (contains Safari's DOM).