html5 force browser to reload or get a new cache

Melody Scott
Melody Scott used Ask the Experts™
on
Hi, I changed a link on my html pages in a site, and I want to be sure people who go there will see the new link and not the old one. What's the newest way to do this?

EG: Used to be <a href="clients.html">Client Feedback</a>, now is <a href="comments/">Client Feedback</a>

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Fixer of Problems
Most Valuable Expert 2014
Commented:
There is no way for a page to force a browser to go to a new page until the page in the browser cache expires.  Browser cache on the client is out of reach of the page on the server.
Sergio Pacheco JiménezAnalyst Developer

Commented:
There is a way to force the browser to don't use the cache  files. This technique is call Cache busting, and basically you have to add a random query at the end of the URL to force the download of the new file e.g.: "test.js?test=1"

Here is a useful link with more information: http://curtistimson.co.uk/front-end-dev/what-is-cache-busting/

Author

Commented:
Thanks, Sergio, this is usually used for css and js files, not static html pages. Dave, I find that surprising, but you're the expert. :)
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Author

Commented:
It seems so strange, that if I change a link in the navigation, people will see the old link until their cache expires. But I accept your answer, thanks!
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
Note that the default cache expiration time in Internet Explorer used to be 20 days...  and while Sergio's idea is frequently used, you still have to wait for the current cache content to expire before you can use it.

Author

Commented:
So... in the circumstance  I talked about, where I replaced an internal link in the navigation, I guess the only way to make customers go to the new page would be to do a 301 redirect, I guess? Permanent redirect clients.html to the new url?
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
No, it has no effect because the browser gets the page from cache and never goes to the server.  Changes are recognized Only when a page is fetched from the server.  Note this can be an even bigger problem with CSS and 'js' files that have changed but the name doesn't change.  Sometimes the main HTML page will change but if the CSS and JS file names don't change, then they will still be fetched from cache.

Author

Commented:
Ok, crazy, man. Seems like there should be a way around it, but thanks for taking the time and having the patience to explain it to me. :)
Dave BaldwinFixer of Problems
Most Valuable Expert 2014

Commented:
The purpose of cache is to speed it up for the client, not the developer.  After you're done, most sites don't change for a long time so that works.  In Google PageSpeed, that is one of the recommendations, "Leverage Browser Caching." by getting the browser to cache things longer.  For development, you can still force a refresh and see the new content.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial