Auto-refresh page once only after first load
I have a web page which isn't working as planned in IE9 (no surprise here). A quick fix is to have the page auto-refresh itself once only after first loading (not continuously). I've tried a few things, like [icode]<body onload="window.location.reload()">[/icode] but this makes it spaz out and refresh repeatedly. Which is odd.
Please let me know if you have any ideas.
What's odd about that? It's doing exactly what you asked. The real solution is to find the cause, however this will give you a single reload:
Originally Posted by W8 4me
if( window.localStorage )
if( !localStorage.getItem( 'firstLoad' ) )
localStorage[ 'firstLoad' ] = true;
localStorage.removeItem( 'firstLoad' );
Note that Ali's script may not work as intended if the user has disabled cookies/storage.
//Check if the current URL contains '#'
// Set the URL to whatever it was plus "#".
url = document.URL+"#";
location = "#";
//Reload the page
Due to the if condition the page will reload only once.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)