Computing.Net > Forums > Web Development > Refresh once on pageload

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Refresh once on pageload

Reply to Message Icon

Name: Beacon
Date: May 15, 2007 at 02:22:57 Pacific
OS: WinXP
CPU/Ram: 1GB
Comment:

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 HELP

Report 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')">





Sponsored Link
Ads by Google

Response Number 1
Name: FBI Agent
Date: May 16, 2007 at 00:17:21 Pacific
Reply:

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.


0
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Refresh once on pageload

meta refresh www.computing.net/answers/webdevel/meta-refresh/1165.html

Javascript - SN u wud be useful www.computing.net/answers/webdevel/javascript-sn-u-wud-be-useful/1648.html

'active' drop-down lists www.computing.net/answers/webdevel/active-dropdown-lists/2861.html