PDA

View Full Version : Auto-Refreshing of Updated Pages


PaulOl
07-19-2011, 12:33 PM
I have been asked this question many times over the past few months, since uploading a new web site, and I don't know the full answer

If I have a viewer sat on my web page, and I then upload an update whilst they're still sat on the page, must they press F5 to see the update or is there any code I can add to the page to force the refresh?

It's not a big deal ... but ... I have a handful of viewers who can't or won't find the F5 button and believe that the update I'm saying is on the page is not there.

??

Corrosive
07-19-2011, 01:58 PM
Not sure you can force the refresh but a couple of clicks on the browser should do the trick. There used to be a meta tag with something like content="no-cache" but I have no idea if that is suitable or even works nowadays.

Cache is what helps your pages load faster for return visitors so I'd do this with a lot of care and consideration if I were you.

PaulOl
07-19-2011, 02:21 PM
I found this, do you reckon it'd work?

<META HTTP-EQUIV="REFRESH" CONTENT="5">

domedia
07-19-2011, 03:02 PM
I found this, do you reckon it'd work?

<META HTTP-EQUIV="REFRESH" CONTENT="5">
Nope, that will refresh the page every 5 seconds. I doubt that is desirable. 8)

PaulOl
07-19-2011, 06:58 PM
Nope, that will refresh the page every 5 seconds. I doubt that is desirable. 8)

I set it to 60 seconds but, no matter, that code didn't seem to have any effect.

domedia
07-20-2011, 01:15 PM
It will work if you implement it correctly. It's a simple meta refresh that's been around forever. But that's not the point; it's not the right solution to your problem.

If it's just a normal web page update, no action is needed. If you have things update continuously, you should give some more info and we'll sort it out.

PaulOl
07-20-2011, 02:54 PM
It's no big deal compared to other web sites perhaps, but on a race day a certain page may be updated a dozen imes with news and stories as they break ... it would be good to have the ability to force-refresh a page that users may be parked on all day.

domedia
07-20-2011, 03:35 PM
It it's live data you should look at other solutions (json/ajax). But it really depends on the exact scenario.

PaulOl
07-20-2011, 03:57 PM
It's not live data, as such, just updated text and/or PDF's and photos

Corrosive
07-20-2011, 06:03 PM
It's no big deal compared to other web sites perhaps, but on a race day a certain page may be updated a dozen imes with news and stories as they break ... it would be good to have the ability to force-refresh a page that users may be parked on all day.

Now it starts to make more sense. That kind of insight would have been good to start with! Like the sports updates on the BBC website. Try something like this; http://www.w3cgallery.com/w3c-blog/php-mysql-ajax-hacks-trick/how-to-ajax-auto-refresh-after-x-seconds