The Praetorian Posted June 20, 2006 Share Posted June 20, 2006 I've noticed that when I change things on my website, sometimes I actually have to go to one of the pages and hit refresh before the changes will take effect. I use FF as my default brower. Is this a browser issue? Or is there a tag I can add to my code to make it refresh automatically on viewing? Link to comment Share on other sites More sharing options...
justsomeguy Posted June 20, 2006 Share Posted June 20, 2006 That is the page being cached. Add this to your head to disable caching for the page:<meta http-equiv="Pragma" content="no-cache" /><meta http-equiv="Expires" content="-1" /> Link to comment Share on other sites More sharing options...
The Praetorian Posted June 20, 2006 Author Share Posted June 20, 2006 Thanks Justsomeguy!Now, just for learning purposes, what exactly does that code tell the browser? Link to comment Share on other sites More sharing options...
aspnetguy Posted June 20, 2006 Share Posted June 20, 2006 The first line tells the browser not to cache the page. and the second does basically the same thing Expiration date of the document. Essentially this will cause a document to be reloaded from the website after the date (even if it is stored in the user's cache). Put a date in the past to disable caching of the document. Link to comment Share on other sites More sharing options...
The Praetorian Posted June 20, 2006 Author Share Posted June 20, 2006 Does that mean I should change the "-1" to say, yesterday's date? Link to comment Share on other sites More sharing options...
aspnetguy Posted June 20, 2006 Share Posted June 20, 2006 I beleive that is what -1 means, yesterday (1 day ago) Link to comment Share on other sites More sharing options...
justsomeguy Posted June 20, 2006 Share Posted June 20, 2006 -1 is just an invalid date, so that it never caches. If some computer has a slow clock and says the date is yesterday, then it will still cache. -1 never caches, because the date is never -1. The two tags are supported by different browsers. I generally skip the pragma one, but I think that one works for Netscrape or something.http://www.htmlgoodies.com/beyond/referenc...cle.php/3472881 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now