Preferred method to reload page with JavaScript?

Posted by Mel on Stack Overflow See other posts from Stack Overflow or by Mel
Published on 2010-04-12T17:45:23Z Indexed on 2010/04/12 18:03 UTC
Read the original article Hit count: 485

Filed under:
|
|
|

Hey Guys, which way to reload a current page (using a button) would you prefer?

<input type="button" value="Reload" onClick="history.go(0)">
<input type="button" value="Reload" onClick="location.reload(true)">
<input type="button" value="Reload" onClick="window.location.reload(true)">
<input type="button" value="Reload" onClick="window.location.href=window.location.href">
<input type="button" value="Reload" onClick="document.location.reload(true)">
<input type="button" value="Reload" onClick="document.location.href=document.location.href">

As the URL of the page changes frequently AFAIK a 'fallback function' like

<a href="urlOfCurrentPage.html" onclick="window.location.reload(true);return false;">Reload</a>

won't work for me, right?

© Stack Overflow or respective owner

Related posts about reload

Related posts about page