Evertjan. said:
Evertjan. wrote on 14 jul 2003 in comp.lang.javascript:
Grant Wagner wrote on 14 jul 2003 in comp.lang.javascript:
Why this return false ??
The page is no longer active !!!
why the true ?
This is enough, I think:
<a href="urlOfCurrentPage.html"
onclick="location.reload();">
Refresh
</a>
The second question I can answer myself:
location.reload(boolean):
false [Default]: Reloads the page from the browser cache.
true: Reloads the page from the server.
But I never saw any proof of that, does it work ????
I'm not sure if window.location.reload(true) guarantees a fresh copy
from the server or not, which is why I also provided a unique URL
solution as well.
As for not returning false from the onclick. While you're right that in
most cases, it is not necessary, at least one browser (IE 5.5) navigates
(or begins to navigate to) the HREF immediately after returning from the
onclick event. As a result, the navigation to the HREF tends to cancel
any redirection you do in the onclick event. For example:
<a href="#" onclick="document.forms[0].submit();">Submit</a>
works in almost every browser except IE 5.5, which never submits the
form.
For this reason, I always return false to the onclick event (where
applicable), even when in most cases, it will never be executed.
--
| Grant Wagner <
[email protected]>
* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/frames.html
* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/author/dhtml/reference/dhtml_reference_entry.asp
* Netscape 6/7 DOM Reference available at:
*
http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 6/7 and Mozilla
*
http://www.mozilla.org/docs/web-developer/upgrade_2.html