Deprecated: Function get_magic_quotes_gpc() is deprecated in /home/styllloz/public_html/qa-include/qa-base.php on line 1175

Warning: session_start(): Cannot start session when headers already sent in /home/styllloz/public_html/qa-include/app/users.php on line 162

Warning: Cannot modify header information - headers already sent by (output started at /home/styllloz/public_html/qa-include/qa-base.php:1175) in /home/styllloz/public_html/qa-include/app/users.php on line 1267

Warning: Cannot modify header information - headers already sent by (output started at /home/styllloz/public_html/qa-include/qa-base.php:1175) in /home/styllloz/public_html/qa-include/app/page.php on line 356
How to force browser not to cache JavaScript? - code-flow.club | Q&A

How to force browser not to cache JavaScript?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
12 views
Is there any effective way to force the browser not to cache a specific Javascript file? It is desirable that this method worked in Firefox, Opera and Chrome (IE not particularly interested).
by | 12 views

5 Answers

0 like 0 dislike
change the file name.
for example, you so script.js?123
instead of a number, i.e. I put the hash sum of the file
by
0 like 0 dislike
And maybe easier on the server side to include the script directly in the html? Each time you refresh the page, the script will restart. Usually this extra traffic, but in your case it will not be superfluous because you want to update the script constantly.
by
0 like 0 dislike
Set the correct headers with the web server.
by
0 like 0 dislike
In all browsers refresh the page with Ctrl+R. never had any problems with the cache.
by
0 like 0 dislike
In ff disabled all caching, atsunobu netwotk.http.use-cache to false.
Tough but worked.
by
110,608 questions
257,186 answers
0 comments
35,181 users