forced reload

merlin's picture

They have: 410 posts

Joined: Oct 1999

i need a page to be reloaded, every time a user comes back to it. i suppose i can do that easily with a javascript. at several javascript-resources i haven't found anything...
can you help me?
thanks a lot
a

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

reloaded everytime a user comes back... sounds like a job for no-cache. Have you tried to keep the page from caching?

merlin's picture

They have: 410 posts

Joined: Oct 1999

yes, i tried... you know, it's for an intranet inside a firewall and our mother-company saves some data to their server, they shouldn't. (we can't keep the page from caching...)
now we only have the possibility to force a reload to show our staff what changed on our site during the day...

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

hmmm...

May be you could check for a cookie.
if false, then reload(), and set cookie
if true, then do nothing
then, onUnload() delete cookie

Or.. you could just tell them to refresh their page (shift+refresh will prevent getting a cached page)

Mark Hensler
If there is no answer on Google, then there is no question.

merlin's picture

They have: 410 posts

Joined: Oct 1999

what i was thinking about:
if someone calls the page, there is a 'timer' and every N minutes, the page is reloaded. i know this is doable Laughing out loud but ... how? Confused

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Have you tried that?

Smiling Suzanne

merlin's picture

They have: 410 posts

Joined: Oct 1999

yup! that's not working... (see above) it's not a workstation-browser-cache-problem. the page is cached somewhere on an intranet-server of our mother-company. and they're not THIS cooperative...

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

timeout reload...

I didn't mention this before because it can get anoying.
Here's the code:

<html>
&lt;script language=javascript&gt;
<!--
function go() {
setTimeout("location.reload()",500)
}
//-->
&lt;/script&gt;
<body onLoad="go()">
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX<BR>
</body>
</html>
'

The 500 needs changed to whatever time you want. It's in milliseconds, so right now it refreshes every half a second. Jut watch the page flicker... Wink

quick conversion to minutes, use this:
N*60*1000 = minutes * (60 seconds in a minute) * (1000 milliseconds)
setTimeout("location.reload()",1*60*1000) //every minute

Good Luck,

Mark Hensler
If there is no answer on Google, then there is no question.

merlin's picture

They have: 410 posts

Joined: Oct 1999

that is, what i was looking for! thank you max...

merlin's picture

They have: 410 posts

Joined: Oct 1999

but one following question:
takes this reload only in place when the user let the page on his screen?
or is it the other way round: the user visits the page, goes away for 5 minutes (to another page), we make some changes and when he comes back to our page, it has chaged 5 times (once/minute)? i think i'll try it out on my own... Wink

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi alibababa,

Max's code will refresh as long as the page is active on the user's computer. If the user leaves the page and then returns the cache is used. If you want the newest page to be visible regardless, you will need to set a cookie as Max originally stated along with the meta tags.

When you used the meta tags, did they look like this?

Or, did you only use the pragma? It shouldn't matter where the page is cached. Also, you can tell your users to set the cache preferences in their browsers to no-cache.

Vinny

Where the world once stood
the blades of grass cut me still

merlin's picture

They have: 410 posts

Joined: Oct 1999

we only used the pragma-one. i added your 'expires' and now it seems to be working...
could you tell me what this tag is doing?

always interested in learning new things,
ali
Laughing out loud

merlin's picture

They have: 410 posts

Joined: Oct 1999

now i smell blood! Wink and i'm getting insatiable... Laughing out loud
following:
the user has our page on his screen. we make some changes on the page and when we save them, the page is reloaded ON the users screen. without any periodical reload ('setTimeout'). is this doable in an easy way?

but anyway, what i have now is 99% perfect, the rest would be heaven! Wink

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

the page cannot be reloaded without any code or actual clicking of 'reload'

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi alibababa,

Essentially, the 'expires' value tells the browser that the page has expired in the 'content' value of time (In the above case '0', or as soon as it is seen. You can put in different values for the content.

I'm a little confused as to the current status of your problem, so if you can expound on the 1% you want.....Smiling

Vinny

Where the world once stood
the blades of grass cut me still

merlin's picture

They have: 410 posts

Joined: Oct 1999

hi vinny

Quote: Originally posted by Vincent Puglia
I'm a little confused as to the current status of your problem, so if you can expound on the 1% you want.....Smiling

well, i can understand that... Wink

i try it once again:
a user has our index.html on his screen for one day. during the day, we as webmasters make some changes on the page. now: right after we save the changes in index.html, the users page is reloaded. this means: there's kind of a signal (or whatever) that sends out the new page after we saved it. so there's no periodical reload in the file and still, the changes will be shown although the user never leaves our index.html.
are you with me? sounds pretty complicated, but in fact, it isn't, believe me! Laughing out loud

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi,

I got that part, but is there still a problem? or a wish list?

Vinny

merlin's picture

They have: 410 posts

Joined: Oct 1999

yes: how can i do that?
the above post is a scenario i wish to realize.

well, that's the problem with writing: it makes things much more complicated as they really are... Wink especially, if there's one writing, who isn't this good in english... Laughing out loud

They have: 88 posts

Joined: Mar 1999

hi all,

You can do the above like this:

where 0 is the time in seconds between refresh
and url is the page to reload it can be the same page
or you can direct it to another.

I hope that this is what you wanted or I might have got
the wrong end of the stick.

HTH

steve

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.