toolman Posted June 10, 2015 Share Posted June 10, 2015 Hi,For some reason, my website has an issue with loading old content until the user refreshes the page. I have read that versioning can help, e.g. adding http://www.website.com/?cache=001I send out emails as a newsletter and was thinking of adding a parameter ?cache=001 to the links in the email to load the latest content. Would adding this just load the latest content on that specific page, or would any other pages on the site load any new content changes?Thanks! Quote Link to comment Share on other sites More sharing options...
requinix Posted June 10, 2015 Share Posted June 10, 2015 Caching does not happen by default - only if something on your server told the browser to cache the content. Versioning isn't really that great of a solution, given that there are others which can cause caching to happen the way you want, and more suited for when you don't have control over the server sending the content (like a CDN). What are the response headers for a page on your site that gets cached? Your browser might have something built-in to see them, or you may need an extension. Caching headers include Last-Modified, ETag, Expires, Cache-Control, and Pragma. Quote Link to comment Share on other sites More sharing options...
fastsol Posted June 10, 2015 Share Posted June 10, 2015 What kind of content are you talking about? Like actual html, css, javascript, images? Versioning does work quite well for things like css and javascript, but html should typically be downloaded on each request unless, like stated above, the server is setting a cache that you are unaware of. Quote Link to comment Share on other sites More sharing options...
fastsol Posted June 10, 2015 Share Posted June 10, 2015 Let me explain just a tiny bit more on the versioning aspect. The kind of example you show is not great for css and javascript. I use php to create a version file name and then have htaccess strip it apart to serve the actual file, while allowing the browser to think it's a new file if the versioned file name is different than before. Quote Link to comment Share on other sites More sharing options...
toolman Posted June 10, 2015 Author Share Posted June 10, 2015 (edited) Thanks for the replies. I want to avoid browsers - so server side. I'm looking for a code that will just reload the most recent content. I added the following which doesn't wor: <meta http-equiv="cache-control" content="max-age=0" /> <meta http-equiv="cache-control" content="no-cache" /> <meta http-equiv="expires" content="0" /> <meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /> <meta http-equiv="pragma" content="no-cache" /> <script type="text/javascript" src="view-source:http://www.website.com/beta/scripts/jquery.min.js The site is based on ASP and labels files as .shtml - I could find a way of insertin PHP, but its not ideal. Edited June 10, 2015 by toolman Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.