Click to See Complete Forum and Search --> : Onload Refresh Once....
spykemitchell
10-11-2003, 07:10 AM
I have an onload function to make the browser refresh but it just refreshes over and over again which i don't want it to do. How do i change this to just make it refresh one?
onload="javascript:location.reload()"
Please Help!
Charles
10-11-2003, 07:44 AM
First, that piece of script, onload="javascript:location.reload(), is syntactically incorrect. You can set the handler from HTML using the form <body onload="location.reload()"> or you can call set it with just JavaScript,
<script type="text/javascript">
onload = function () {location.reload()}
</script>
But as you've noticed you cannot use JavaScript for what you are after. You need to adjust the HTTP response header that the server sends so that the pages expiration date is sometime in the past. Talk to your server people.
spykemitchell
10-11-2003, 08:54 AM
So there is no way i can make a page reload once when it starts?
Not even using PHP? It is a php document so could i use that?
Khalid Ali
10-11-2003, 09:30 AM
Originally posted by spykemitchell
So there is no way i can make a page reload once when it starts?
Of course you can,but that will be a work around...see what happens is every time page loads it will call the reload method,and that will put your pag into a sweet infinite loop, which I am sure you are not after.
What you can do is when page loads look for some flag appended to the URL if its not there then reload the page if its there (append a flag when page is reloaded once) then do not reload any more
Charles
10-11-2003, 11:59 AM
Originally posted by spykemitchell
So there is no way i can make a page reload once when it starts?
Not even using PHP? It is a php document so could i use that? Using PHP there should be a way to manipulate the HTTP response header. And it will work much better than any JavaScript method.
spykemitchell
10-12-2003, 12:05 PM
Could this then be moved to the PHP section so i can sort it out there please!
Thanks for your help so far!