Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
My question refers to below post earlier.
This works fine, But I have a different problem. I have a tabbed page and using
location.href+'?reload' takes the page back to the default tab.
I want to keep the page in the same tab which is being refreshed.. Any help??
=============== OLD POST ===================
Is there a way to use javascript to refresh a page once onLoad? w/out getting stuck in a loop?
I have this but it gets stuck in a loop:<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><script type="text/javascript">
function refreshPage(){
window.location.reload( false );
}</script>
</head>
<body onLoad="refreshPage()">
woot
</body>
</html>
PLEASE HELPReport Offensive Message For Removal
=======================
Response Number 1
Name: gpp
Date: March 22, 2004 at 13:20:43 Pacific
Subject: Refresh a page once?
Reply:
<body onLoad="if (location.href.indexOf('reload')==-1) location.replace(location.href+'?reload')">

first off, i see no point in this.
as for a solution, put a javascript code at the VERY top of the page telling it to refresh after one second only once, something like:
if timer = 1000 then (refresh and disable/turn off timer)i dont know javascript but that would definately work... and at the VERY BOTTOM of the page put "}" to enclose the ENTIRE contents of the pages inside of the javascript refresher. i've actually done something EXACTLY like that before for a chat box that i made. it refreshed once every ten seconds... i used frames. it works and it's kinda cool but i can do way better stuff with my knowledge now.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |