Direct TV - Weight Loss - Mobile Phone - Loans - Cheap Car Insurance

PDA

View Full Version : Getting Users to Refresh your Web Page


misohoni
Jul 27th 2004, 8:21 pm
What I mean is that users are going to my site but not refreshing the page so see new content. Is there some special tag I can implement on my page?

digitalpoint
Jul 27th 2004, 10:22 pm
This should do it...

<META HTTP-EQUIV="REFRESH" CONTENT="30; URL=http://www.digitalpoint.com/">

That will refresh to the URL listed after 30 seconds.

mopacfan
Jul 28th 2004, 6:15 am
Won't that refresh the page every 30 seconds? I don't know of any way to refresh the page just once.

TwisterMc
Jul 28th 2004, 6:18 am
You need to find a tag that doesn't allow the page to be cached. Is it just HTML? Or PHP? Or what?

T0PS3O
Jul 28th 2004, 6:21 am
The CONTENT="30; URL=http://www.digitalpoint.com/"> bit never made sense to me. Why not like all tags and parameters two quotes (or none) as oppose to the ; :S

Anyway, that is one way of doing it.

There is indeed a no cache option too but dunno the code.

mopacfan
Jul 28th 2004, 6:41 am
I believe it's pragma-nocache or something like that.

misohoni
Jul 28th 2004, 7:05 am
yep the 30 second refresh is an ok idea, but will cause alot of bandwidth usuage and annoyance to the readers.

I heard of the nocache also, can't remember the exact code. Will that help though, since the site that's on their computers is the cached version. It's difficult to explain, but I'd like to just create a one-time huge refresh which updates the cache on their pc.

TwisterMc
Jul 28th 2004, 7:19 am
good ol google

http://www.htmlgoodies.com/beyond/nocache.html

misohoni
Jul 28th 2004, 7:26 am
woah, it's here - <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">

Thanks guys, hope this is some use to others too...

T0PS3O
Jul 28th 2004, 7:48 am
Isn't your site database driven? That should pull out fresh content each time.

Joel Naten
Jul 28th 2004, 8:07 am
It actually works best if you use use the HTTP directives instead of HTML. Browsers don't always seem to respect what's in the HTML, but they seem to pay attention to the HTTP directives.

Owlcroft
Jul 28th 2004, 2:46 pm
You also need to take care to see that you are addressing both HTTP 1.0 and HTTP 1.1.

In PHP, for example:
// HTTP/1.1
header("Cache-Control: no-cache");

// HTTP/1.0
header("Pragma: no-cache");
HTTP 1.1 will always honor that directive; HTTP 1.0 will usually, but it cannot be guaranteed.

(Note that if you are actually using PHP to send those headers, you need to take the standard PHP cautions about headers, to make sure that they truly get sent--check the PHP manual for detail, but in brief, you need those statements before either the HTML or the PHP outputs anything (else the headers are already on their way by the time you try to add to them).