Quantcast
Channel: How to force browsers to reload cached CSS and JS files? - Stack Overflow
Browsing all 173 articles
Browse latest View live

Answer by astronought for How to force the browser to reload cached CSS/JS...

If you are a developer looking to avoid caching, chrome network tab has disable cache option. Otherwise you can do it without a server rendering framework using two script tags. <script...

View Article



Answer by Jessie Lesbian for How to force the browser to reload cached CSS/JS...

You can use SRI to break the browser cache. You only have to update your index.html with the new SRI hash every time. When the browser loads the HTML and finds out the SRI hash on the HTML page didn't...

View Article

Answer by Bangash for How to force the browser to reload cached CSS/JS files?

One of the best and quick approach I know is to change the name of the folder where you have CSS or JS Files. OR for Developers. Change the name of your CSS/js files something like versions. <link...

View Article

Image may be NSFW.
Clik here to view.

Answer by Jajikanth pydimarla for How to force the browser to reload cached...

Small improvement from existing answers... Using random number or session id would cause to reload on each request. Ideally we may need to change only if some code changes were done in any js/css file....

View Article

Answer by Luis Cambustón for How to force the browser to reload cached CSS/JS...

Just use server side code to add the date of the file... that way it WILL be cached and only reloaded when the file changes In ASP.NET <link rel="stylesheet"...

View Article


Answer by Pawel for How to force the browser to reload cached CSS/JS files?

Disable cache of script.js only for local development in pure JS injects random script.js?wizardry=1231234 and blocks regular script.js <script type="text/javascript">...

View Article

Answer by unknown123 for How to force the browser to reload cached CSS/JS files?

google chrome has Hard Reload as well as Empty Cache and Hard Reload option.You can click and hold the reload button (In Inspect Mode) to select one .

View Article

Answer by Karan Shaw for How to force the browser to reload cached CSS/JS files?

Simply add this code, where you want to do hard reload (force browser to reload cached CSS/JS files ) Do this inside the .load so it does not refreshes like a loop $( window ).load(function() {...

View Article


Answer by Kamil Kiełczewski for How to force the browser to reload cached...

In Laravel (PHP) we can do it in following clear and elegant way (using file modification timestamp): <script src="{{ asset('/js/your.js?v='.filemtime('js/your.js')) }}"></script> And...

View Article


Answer by readikus for How to force the browser to reload cached CSS/JS files?

If you're using git + PHP, you can reload the script from cache each time there is a change in the git repo, using the following code: exec('git rev-parse --verify HEAD 2> /dev/null', $gitLog); echo...

View Article

Answer by Al3abMizo Games for How to force the browser to reload cached...

Well, I have made it work my way by changing js version each time the page load by adding a random number to js file version as follow: // Add it to the top of the page <?php srand(); $random_number...

View Article

Answer by commonpike for How to force the browser to reload cached CSS/JS files?

It seems all answers here suggest some sort of versioning in the naming scheme, which has its downsides. Browsers should be well aware of what to cache and what not to cache by reading the webservers...

View Article

Answer by GreQ for How to force the browser to reload cached CSS/JS files?

Have not found the client sided DOM approach creating the script node (or css) element dynamically: <script> var node = document.createElement("script"); node.type = "text/javascript"; node.src =...

View Article


Answer by statler for How to force the browser to reload cached CSS/JS files?

I came to this question when looking for a solution for my SPA, which only has a single index.html listing all the necessary files. While I got some leads that helped me, I could not find a quick and...

View Article

Answer by Michael Kropat for How to force the browser to reload cached CSS/JS...

The 30 or so existing answers are great advice for a circa 2008 website. However, when it comes to a modern, single page application (SPA), it might be time to re-think some fundamental assumptions…...

View Article


Answer by Frank Bryce for How to force the browser to reload cached CSS/JS...

For my development, I find that chrome has a great solution. https://developer.chrome.com/devtools/docs/tips-and-tricks#hard-reload With developer tools open, simply long click the refresh button and...

View Article

Answer by pinkp for How to force the browser to reload cached CSS/JS files?

I'm adding this answer as a SilverStripe http://www.silverstripe.org specific answer which I was looking for and never found but have worked out from reading:...

View Article


Answer by Lloyd Banks for How to force the browser to reload cached CSS/JS...

Here is a pure JavaScript solution (function(){ // Match this timestamp with the release of your code var lastVersioning = Date.UTC(2014, 11, 20, 2, 15, 10); var lastCacheDateTime =...

View Article

Answer by undefined for How to force the browser to reload cached CSS/JS files?

Many answers here advocate adding a timestamp to the url. Unless you are modifying your production files directly, the file's timestamp is not likely to reflect the time when a file was changed. In...

View Article

Answer by user3738893 for How to force the browser to reload cached CSS/JS...

For ASP.NET 4.5 and greater you can use script bundling. The request http://localhost/MvcBM_time/bundles/AllMyScripts?v=r0sLDicvP58AIXN_mc3QdyVvVj5euZNzdsa2N1PKvb81 is for the bundle AllMyScripts and...

View Article
Browsing all 173 articles
Browse latest View live




Latest Images