navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

Refresh the Page Once OnLoad

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Refresh the Page Once OnLoad
Page: [1] 2   next >   >>
 
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
Refresh the Page Once OnLoad - 8/23/2002 20:40:24   
Hi All,

How can I refresh a page once when it loads, using JavaScript, VBScript or HTML.

Something like onload=window.refresh.

I know how to make it refresh every xSeconds. But I want it to refresh only once onLoad.

I tried the following to refresh the window once, Is it right?
<Body onLoad=window.refresh>

I know how to refresh it after an amount of time, like this
<META HTTP-EQUIV=" refresh" content=" 300;URL=
http://www.myapage.com/folder/page.htm" >

This will make it refresh every 5 minutes. I just want it to refresh once on load.

Thanks


Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/23/2002 21:56:24   
Try this:

Place this at the top of your page:

<script language=" JavaScript" ><!--
function MyReload()
{
window.location.reload();
}
//--></script>

Then change your <Body> to say;

<Body onLoad=" MyReload()" >

That should do it.



_____________________________


(in reply to hhammash)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 6:25:21   
Thank you verymuch lune.


Hisham

(in reply to hhammash)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 6:30:50   
Hi Lune,

Do I have to specify any location? I tested the page, it is stuck in a loop.

Thanks
Hisham

(in reply to hhammash)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 10:24:30   
Did you remove your meta tags?
Also, remove any programming on that page you experimented with prior. The <onload> only occurs once. It' s my guess that it' s your meta tags or something else that is still on the page.



_____________________________


(in reply to hhammash)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 10:39:10   
Question:

Why would you want to refresh your page immediately after it loads?

Forgive my ignorance, but it seems kind of redundant. Interesting enough, though, that I' d like to know why you would do it in case it' s something I can use!

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to hhammash)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 11:46:24   
Interesting question. Crossed my mind too.

_____________________________


(in reply to hhammash)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 12:44:52   
Hi,

1-It is still stuck in a loop, I pasted the code in new page which has no programming at all.

To answer your question
There is a person who asked me how to do it for one reason.

She does not know why the horizontal scroll bar is coming to the page and when she presses refresh, the horizontal scroll bar goes and the page looks fine. She is not using any frames.

She designed the page using Frontpage. This is why she wants a solution for either getting rid of the Horizontal scroll bar or refresh the page autoamtically once onLoad.

Regards
Hisham

< Message edited by hhammash -- 8/23/2002 12:46:10 PM >

(in reply to hhammash)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 12:58:34   
Hisham,

It sounds like your friend has a bigger problem than trying to refresh the page. If a horizontal navigation bar appears than disappears on a refresh, wouldn' t it be smarter to attack this problem???

Your right, the method I gave you does not actually work. I tried it. The page reloads, then goes to the <body>, then reloads, then goes to the <Body> and so on and so on. It' s true that the <Body> is only executed once on a page load, but if you keep reloading the page, <Body> is going to get executed each time. I don' t think there is an answer to this loop problem. If I were you, I would concentrate on how to stop the horizontal bar from displaying.

When it comes to FP automatic navigation bars - HOMEY DON' T PLAY THAT. Maybe you should repost your question. Sorry...


_____________________________


(in reply to hhammash)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 13:32:20   
Hmmmm.... so there' s a horizontal scroll bar the first time the page loads... but not after it' s refreshed?

That doesn' t make a whole lot of sense...

Can you post a link so we can check it out?

How long has it been happening? Does it happen to everyone or just on her machine?

Refreshing a page shouldn' t change the way it' s rendered... seems really odd to me... :)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to hhammash)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 16:01:47   
Hi bobby,

I know it seems odd to me too, this is why I got interested. I will try and get the page address.

Thanks
Hisham

(in reply to hhammash)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 17:40:20   
You might check to see if she' s going to the page via a bookmark or from her favorites directory... if so she may be getting a cached page the first time... and then the refresh grabs the new version?

That' s the only thing I can think of...

I' ll check back on Monday and see if you have a link up yet.

Have a great weekend!

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to hhammash)
carm

 

Posts: 11
Joined: 8/16/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/24/2002 23:52:08   
I had this problem, but only when being viewed on netscape. Have her check the sizes on all tables used on the page and make sure that everything adds up.

My problem came in that although the table sizes added up, i used a table inside a table specifying a % and it through everything off on netscape. Mine too would work fine after I reloaded the page.

It might be the cause, it might not be.. good luck.

(in reply to hhammash)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/25/2002 9:02:25   
Hi all,

I' ve got the link.
I tested it.
It is fine.

http://www.swreporter.com

Hisham

(in reply to hhammash)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/26/2002 3:46:51   
I' m on IE6 and I get a horizontal scroll all the time at 800 x 600.

It acts like the page is 3 or 4 pixels too wide... the scrollbar is there, but only moves a fraction...

The only thing that made sense to me was that the first table is 768 px wide, and the left margin is set to 6... 774 must be just too wide on my monitor with the vertical scrollbar.

Refresh doesn' t get rid of it.

(Have her try removing the bolded code and see if it helps:

<table border=" 0" cellpadding=" 0" cellspacing=" 0" style=" border-collapse: collapse" bordercolor=" #111111" width=" 768" height=" 652" background=" SWR1pt2.gif" >

NN doesn' t support the " Border-collapse" style... so it' s been known to hiccup.)



_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to hhammash)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/26/2002 4:32:41   
Thank you bobby,

I will convey the message

Hisham

(in reply to hhammash)
bobby

 

Posts: 11394
Joined: 8/15/1969
From: Seattle WA USA
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/26/2002 15:36:53   
Let us know if that does it... I' m curious about what' s causing the phenom.

:)

_____________________________

If con is the opposite of pro, is Congress the opposite of progress?


:)

(in reply to hhammash)
ACEDISH

 

Posts: 176
Joined: 9/30/2002
From: Manassas, Virginia
Status: offline

 
RE: Refresh the Page Once OnLoad - 10/30/2002 17:09:49   
wow, someone else ran into this problem!! I have it happen to me all the time but not on all my pages and refresh will fix it. I have had it happen using frames, without frames with FP2000 and FP2002. I have a situation now go to www.dishtrack.com and notice on the right side there is a space hit refresh and it goes away...

(in reply to hhammash)
Eli

 

Posts: 2658
From: ... er ...
Status: offline

 
RE: Refresh the Page Once OnLoad - 10/30/2002 19:04:58   
i couldn' t see any difference with either urls. This is a very interesting thread - what am I missing?!

ie 5.5 800x600

(in reply to hhammash)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 10/30/2002 20:22:04   
I went to this site too and looked on the right. What are we looking for???

_____________________________


(in reply to hhammash)
ACEDISH

 

Posts: 176
Joined: 9/30/2002
From: Manassas, Virginia
Status: offline

 
RE: Refresh the Page Once OnLoad - 11/1/2002 22:42:48   
Its a very small space at the right of the blue header and footer bar on the page. When you hit refresh it goes to full page, It is more noticable on other pages.

www.dishtrack.com
If anyone is interested,
Costa

(in reply to hhammash)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 11/1/2002 23:47:37   
Acedish,

I tried it again. The page looks the same to me before and after refresh. Sorry - I can' t see it.


_____________________________


(in reply to hhammash)
Levi

 

Posts: 7
Joined: 11/2/2002
From: Vine Grove Kentucky
Status: offline

 
RE: Refresh the Page Once OnLoad - 11/3/2002 12:19:01   
I' m something of a newbie but why not make the page not catch at all that way all onloads are a fresh start. In my site i use:)

<%
Response.Expires = -1000
Response.Buffer = True
%>

This will not allow the puter to save the page. Thus when you view it, it must be load a new. Though I am a newbie........:)


(in reply to Long Island Lune)
hhammash

 

Posts: 1064
Joined: 8/19/2002
Status: offline

 
RE: Refresh the Page Once OnLoad - 11/3/2002 14:42:29   
Hi Levi,

I see you here too :)

Levi, my friend' s page does not have a problem wich caching. The problem comes even when you open the page from another computer which does not have it in the cache.

Thanks
Hisham

(in reply to hhammash)
dvfortuna

 

Posts: 1
Joined: 8/13/2003
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/13/2003 22:42:07   
Good day all,

i am new to this forum. i hope you could help me.

i have the same problem. but with slight difference. i have a page with german characters on it. there are times that the characters wont display properly and there are times it will display correctly. most of the time it wont display correctly is the the first visit but after you refresh the characters will display properly. i have tried it on 5 computers and 2 out of 5 computers will act this way.

as of the moment i dont know why this is happening. but as of the mean time i need a code which will refresh the page once. this is just a temporary solution until i figure it why this happen.

FYI:
the page already have
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

i cant give you link to the page since it not up yet. but as soon its already up, ill post the link.

thanks,

(in reply to hhammash)
Long Island Lune

 

Posts: 2340
Joined: 6/8/2002
From: New York
Status: offline

 
RE: Refresh the Page Once OnLoad - 8/15/2003 18:53:51   
Have you tried placing this line in your body label?

<Body onLoad=window.refresh>

This will refresh the page once each time someone visits.

_____________________________


(in reply to hhammash)
sparticus_79a

 

Posts: 1
Joined: 2/9/2005
Status: offline

 
RE: Refresh the Page Once OnLoad - 2/9/2005 16:06:38   
On the current webpage write a cookie, then insert <body onload="history.go(-1)"> command forcing the page to go back, now on the previous page write a code like,

<%
if cookie<>"1" then
response.cookies("1").Expires = Date-1000
response.redirect("your_page.asp")
end if
%>

this will refrest the page until the cookie is deleted

(in reply to hhammash)
bigron

 

Posts: 1
Joined: 12/13/2005
Status: offline

 
RE: Refresh the Page Once OnLoad - 12/13/2005 4:31:06   
Hi All,

Try this;

<script type="text/javascript">


if (window.name!="xxxxxx")
{
window.name="xxxxxx";

location.reload();

confirm("Done it, page reloaded.");
}

Stick code between the <headers></headers> of your page.


Don't forget to remove the confirm line of code; it's only there to let you know that it has worked.




(in reply to hhammash)
JasonBoyd

 

Posts: 2
Joined: 4/21/2006
Status: offline

 
RE: Refresh the Page Once OnLoad - 4/21/2006 13:21:08   
I have a similar problem I wonder if anyone handling this could solve. I have a site similar to that of windows live or personalized google which uses AJAX to save changes that occur on a page, such as dragging the location of RSS feeds etc. Everything works great but if these settings change e.g. you move the item in position 1,1 to position 1,3 then you click a link on the page and use the back button to go back to that page, those changes are not kept. But if the page reloads, allowing the page to be built from the previously saved settings, then everything is fine.

So what my question is is there a way to detect that someone has backed up to this page, thus forcing the user to reload it.

pragma no-cache doesn't seem to work and all I can think of is to force a postback on load so that the page isn't displayed but this could cause some unwanted overhead.

Any ideas?

(in reply to hhammash)
JasonBoyd

 

Posts: 2
Joined: 4/21/2006
Status: offline

 
RE: Refresh the Page Once OnLoad - 4/21/2006 14:37:15   
ok I found that this will work in IE:

Response.Cache.SetCacheability(HttpCacheability.ServerAndNoCache);
Response.Cache.SetAllowResponseInBrowserHistory(false);

but it doesnt work in NS, Firefox, any ideas what this does?

(in reply to JasonBoyd)
Page:   [1] 2   next >   >>

All Forums >> Web Development >> ASP and Database >> Refresh the Page Once OnLoad
Page: [1] 2   next >   >>
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts