Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing a refresh

Status
Not open for further replies.

carlosAlberto

IS-IT--Management
Oct 9, 2001
109
GB
How can i force my html page to refresh?????
 
is this what you are looking for?

onclick="window.self.location.reload();"

 
I would like to refresh the page after it has loaded.

I have tried putting this into <body onload=...... but this is an endless loop.

How do i do this after a certain time period???? or something along them lines....
 
try making a refresh funtion like this in a script block or external js

function refresh(){
window.self.location.reload();
}

and then calling it a the bottom of your page like this

<script type=&quot;text/javascript&quot;>
<!--//
setTimeout(&quot;refresh()&quot;, 10000);
//-->
</script>

you can alter the wait by changin the num,ber of milliseconds in the timeout (currently 10000). if you want to prevent a continuos loop forming which would probably make this more useful you could try redirecting the page to iself

window.self.location.href=&quot;page.htm&quot;;

and appending a querystring like

window.self.location.href=&quot;page.asp?pass=1&quot;;

you can then request the querystring (using asp or javacsript) and call the refresh function depending ion ther value of it.

hope this helps you any more questions post here

rob
 
sorry i didnt make that very clear!! by redirecting to itself you effectively refresh the page. however it enables you to pass a querystyring to the page. this way when you refresh you have the ability to track the state of the page. wether it has been loaded from scratch or through the refresh. if you choose to use this method then you won't require to reload the page but to redirect it to itself iun the refresh function.

good luck

rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top