Jump to content
Stef's Coding Community

Forced Refresh?


Recommended Posts

Hello again folks. Is it possible to force a "refresh" when a visitor opens a page on my website which has been updated since their last visit? Every time I update a page, my son has to be told to refresh the page in order to see the changes. Thanks in advance! -Woody

Link to post
Share on other sites

You can set these headers, so a user's browser doesn't cache your pages:

 

Cache-control: private

Pragma: no-cache

Expires: (a date in the past)

 

But you need some kind of server-side code, ASP/PHP etc, also don't think it's a good practice for performance. But this is a beginners section, don't know if I should go in detail here. So I'll just leave it at that.

Link to post
Share on other sites

Meta refresh redirects have been used by spammers to fool search engines. So search engines remove those sites from their database. If you use a lot of meta refresh tags to redirect pages, the search engines may decide your site is spam and delete it from their index.

 

Below is just a refresh with no redirect.

 

<meta http-equiv="refresh" content="600">

 

 

600 the amount of time in seconds the browser should refresh page.

Edited by Webkiller
Link to post
Share on other sites

Oh my god, How can I forget <meta> tags lol. But Webkiller, OP is not looking for a way to refresh a page, he wants a way to refresh the cache in a user's browser. But thanks for reminding me about <meta> tag

 

Disregard what I said above, you don't really need server side code, you can bung those above that I mentioned into a <meta> tag.

 

This is a good place to read about those cache controlling meta tags: http://www.i18nguy.com/markup/metatags.html

 

<meta HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="Mon, 22 Jul 2002 11:12:01 GMT">

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...