Force-refreshing only JavaScript files in Firefox and Chrome
I want to clear only JavaScript files from my web browsers (Firefox and Chrome). I am doing JavaScript debugging, and it's annoying that my JS just won't get updated whenever I change my JS files. The only thing I can do now is to clear my cookies, but doing that erases all of my browsing history.
How can I clear/refresh the JavaScript files that have been loaded into my browsers without clearing out other files?
firefox google-chrome browser
add a comment |
I want to clear only JavaScript files from my web browsers (Firefox and Chrome). I am doing JavaScript debugging, and it's annoying that my JS just won't get updated whenever I change my JS files. The only thing I can do now is to clear my cookies, but doing that erases all of my browsing history.
How can I clear/refresh the JavaScript files that have been loaded into my browsers without clearing out other files?
firefox google-chrome browser
add a comment |
I want to clear only JavaScript files from my web browsers (Firefox and Chrome). I am doing JavaScript debugging, and it's annoying that my JS just won't get updated whenever I change my JS files. The only thing I can do now is to clear my cookies, but doing that erases all of my browsing history.
How can I clear/refresh the JavaScript files that have been loaded into my browsers without clearing out other files?
firefox google-chrome browser
I want to clear only JavaScript files from my web browsers (Firefox and Chrome). I am doing JavaScript debugging, and it's annoying that my JS just won't get updated whenever I change my JS files. The only thing I can do now is to clear my cookies, but doing that erases all of my browsing history.
How can I clear/refresh the JavaScript files that have been loaded into my browsers without clearing out other files?
firefox google-chrome browser
firefox google-chrome browser
edited Sep 2 '11 at 20:27
Pops
4,695246390
4,695246390
asked Sep 5 '09 at 2:01
Graviton
2,587216386
2,587216386
add a comment |
add a comment |
12 Answers
12
active
oldest
votes
I do this myself for development. I use Ctrl+F5. It's like a force refresh. This refreshes the page including re-downloading any referenced JavaScript files or CSS files even if they were cached.
It will NOT clear anything else such as your browsing history.
But please note that although I know this works in Firefox, and probably Internet Explorer, I am not sure if Ctrl+F5 works the same way in Chrome.
Also, iegik says:
On some browsers you can use `Ctrl+Shift+R to do the same task.
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
2
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
1
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
1
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
|
show 4 more comments
With Chrome:
Starting with Chrome 15, open the Developer Tools, click on the cogwheel at bottom left of the screen, and select the checkbox Disable cache.

This way, you will be sure that resources are always reloaded from the server, and you don't have to manually clear the cache, which might also remove cached data for unrelated sites.
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
|
show 1 more comment
I disagree with @7wp. Since some of your end users aren't familiar with the Ctrl+F5 function, and some aren't even aware of the differences between browsers and even the existance of other browsers (elders for example) you should force the browser to download a new copy of the JS/CSS files.
The best solution here is to add the timestamp at the end of the .js/.css filenames, or add the svn version which is a great idea too.
<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>
add a comment |
You might want to try clearing just your cache, and not your entire browsing, history, cookies, passwords, saved form data, and whatnot (the default).
In Firefox 3.5, go to
Tools » Clear Recent History...
Then make sure only "Cache" is selected before selecting "Clear Now."
In Chrome (don't know what particular version you're using, as I use the dev builds), go to
Wrench Icon (Tools) » Options » Personal Stuff tab » Clear browsing data...
Again, make sure only "Empty the cache" is checked.
Alternatively, you can try opening up a new Private session in Firefox or Incognito window in Chrome; neither should cache any files (including your .JS files) you automatically download and process when browsing.
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
add a comment |
I've been using a little trick on a site that I'm working on...for the same reasons as you. I make small changes and have JavaScript code loaded by JavaScript code and want to make sure that I'm always working with the current (non-cached) script.
Try making the JavaScript code you are loading into a PHP file...simply put <?php ?> at the beginning and put on the ext of .php.
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
// The Date added to the file doesn't effect the results but
// helps Internet Explorer be sure to refresh the data and
// not use cache
var d = new Date();
var t = d.getTime();
fileref.setAttribute("src", filename + ".php?date=" + t);
fileref.setAttribute("id", filename);
Because the name changes, Internet Explorer thinks it is a new file ;)
1
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
1
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
add a comment |
In Chrome you can just press Ctrl and click the refresh button. I discovered this by chance.
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
add a comment |
I open the JavaScript file in a separate tab, Shift + refresh, verify that I'm seeing the latest changes, then Shift + refresh the actual page (actually, in my case, frame in a frameset, which seems to make matters worse). This works almost all the time.
add a comment |
I've not used it myself, but the Firefox Add-on "Clear Cache Button" might be of use. I read through their documentation, so I'm not sure if it clears your browsing history too.
add a comment |
Go to content settings in Chrome, disable JavaScript and save.
Then, enable JavaScript again.
add a comment |
If you are working with JavaScript and worried about reloading the page to reflect JavaScript changes. Try to use the Chrome debugger, where you can make changes to your loaded JavaScript file(s) at run time and without using any reload can test new functions or changes you want to test.
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
add a comment |
In the latest Chrome it is available:

Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
add a comment |
Add some dynamic date function at the end of your JavaScript file. It will force the browser to load the updated JavaScript file. Meaning, when including the .js file you could add .... xyz.js?
< ? php echo date('l jS of F Y h:i:s A') ? >
Of course this could be removed once your debugging is done and ready to go live.
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f36106%2fforce-refreshing-only-javascript-files-in-firefox-and-chrome%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
12 Answers
12
active
oldest
votes
12 Answers
12
active
oldest
votes
active
oldest
votes
active
oldest
votes
I do this myself for development. I use Ctrl+F5. It's like a force refresh. This refreshes the page including re-downloading any referenced JavaScript files or CSS files even if they were cached.
It will NOT clear anything else such as your browsing history.
But please note that although I know this works in Firefox, and probably Internet Explorer, I am not sure if Ctrl+F5 works the same way in Chrome.
Also, iegik says:
On some browsers you can use `Ctrl+Shift+R to do the same task.
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
2
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
1
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
1
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
|
show 4 more comments
I do this myself for development. I use Ctrl+F5. It's like a force refresh. This refreshes the page including re-downloading any referenced JavaScript files or CSS files even if they were cached.
It will NOT clear anything else such as your browsing history.
But please note that although I know this works in Firefox, and probably Internet Explorer, I am not sure if Ctrl+F5 works the same way in Chrome.
Also, iegik says:
On some browsers you can use `Ctrl+Shift+R to do the same task.
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
2
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
1
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
1
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
|
show 4 more comments
I do this myself for development. I use Ctrl+F5. It's like a force refresh. This refreshes the page including re-downloading any referenced JavaScript files or CSS files even if they were cached.
It will NOT clear anything else such as your browsing history.
But please note that although I know this works in Firefox, and probably Internet Explorer, I am not sure if Ctrl+F5 works the same way in Chrome.
Also, iegik says:
On some browsers you can use `Ctrl+Shift+R to do the same task.
I do this myself for development. I use Ctrl+F5. It's like a force refresh. This refreshes the page including re-downloading any referenced JavaScript files or CSS files even if they were cached.
It will NOT clear anything else such as your browsing history.
But please note that although I know this works in Firefox, and probably Internet Explorer, I am not sure if Ctrl+F5 works the same way in Chrome.
Also, iegik says:
On some browsers you can use `Ctrl+Shift+R to do the same task.
edited Dec 8 at 20:27
Peter Mortensen
8,331166184
8,331166184
answered Sep 5 '09 at 2:54
7wp
1,00521524
1,00521524
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
2
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
1
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
1
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
|
show 4 more comments
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
2
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
1
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
1
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
Great! I change the accepted answer to yours because yours is a simpler solution
– Graviton
Sep 5 '09 at 3:18
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
I appreciate that... But please note that although I know this works in Firefox, and probably IE, I am not sure if CTRL-F5 works the same way in Chrome.
– 7wp
Sep 5 '09 at 3:27
2
2
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
Same with Chrome 21 beta on Win7 - refreshing the page with ctrl-f5 doesn't re-request the JS file (I'm using Charles to double verify).
– Artem Russakovskii
Jul 13 '12 at 3:24
1
1
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
actually chrome treats first ctrl+f5 as normal refresh by design, subsequent ctrl+f5 (more then one) in short time will force reload of all sources
– Zeela
Sep 7 '12 at 12:06
1
1
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
For Chrome, F12 and rightclick the reload button. superuser.com/questions/220179/…
– Cees Timmerman
Mar 24 '15 at 8:52
|
show 4 more comments
With Chrome:
Starting with Chrome 15, open the Developer Tools, click on the cogwheel at bottom left of the screen, and select the checkbox Disable cache.

This way, you will be sure that resources are always reloaded from the server, and you don't have to manually clear the cache, which might also remove cached data for unrelated sites.
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
|
show 1 more comment
With Chrome:
Starting with Chrome 15, open the Developer Tools, click on the cogwheel at bottom left of the screen, and select the checkbox Disable cache.

This way, you will be sure that resources are always reloaded from the server, and you don't have to manually clear the cache, which might also remove cached data for unrelated sites.
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
|
show 1 more comment
With Chrome:
Starting with Chrome 15, open the Developer Tools, click on the cogwheel at bottom left of the screen, and select the checkbox Disable cache.

This way, you will be sure that resources are always reloaded from the server, and you don't have to manually clear the cache, which might also remove cached data for unrelated sites.
With Chrome:
Starting with Chrome 15, open the Developer Tools, click on the cogwheel at bottom left of the screen, and select the checkbox Disable cache.

This way, you will be sure that resources are always reloaded from the server, and you don't have to manually clear the cache, which might also remove cached data for unrelated sites.
answered Sep 2 '11 at 18:08
avernet
1,31851723
1,31851723
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
|
show 1 more comment
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Thanks for the tip - I just checked and that option is in Chrome 14 also.
– keybits
Sep 9 '11 at 18:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Genius! That's a great find.
– Randomblue
Sep 30 '11 at 21:00
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
Brilliant, I was looking for this.
– Artem Russakovskii
Jul 13 '12 at 3:25
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
... and just don't forget to uncheck the option after you are done with it.
– Halil Özgür
Nov 30 '12 at 11:43
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
On a second take, it looks like these options are only active when the devtools is visible: twitter.com/ChromiumDev/status/227356682890670080 (from stackoverflow.com/a/7000899/372654)
– Halil Özgür
Nov 30 '12 at 11:55
|
show 1 more comment
I disagree with @7wp. Since some of your end users aren't familiar with the Ctrl+F5 function, and some aren't even aware of the differences between browsers and even the existance of other browsers (elders for example) you should force the browser to download a new copy of the JS/CSS files.
The best solution here is to add the timestamp at the end of the .js/.css filenames, or add the svn version which is a great idea too.
<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>
add a comment |
I disagree with @7wp. Since some of your end users aren't familiar with the Ctrl+F5 function, and some aren't even aware of the differences between browsers and even the existance of other browsers (elders for example) you should force the browser to download a new copy of the JS/CSS files.
The best solution here is to add the timestamp at the end of the .js/.css filenames, or add the svn version which is a great idea too.
<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>
add a comment |
I disagree with @7wp. Since some of your end users aren't familiar with the Ctrl+F5 function, and some aren't even aware of the differences between browsers and even the existance of other browsers (elders for example) you should force the browser to download a new copy of the JS/CSS files.
The best solution here is to add the timestamp at the end of the .js/.css filenames, or add the svn version which is a great idea too.
<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>
I disagree with @7wp. Since some of your end users aren't familiar with the Ctrl+F5 function, and some aren't even aware of the differences between browsers and even the existance of other browsers (elders for example) you should force the browser to download a new copy of the JS/CSS files.
The best solution here is to add the timestamp at the end of the .js/.css filenames, or add the svn version which is a great idea too.
<script src="js/myfile.js?t=<?=time()?>" type="text/javascript"></script>
edited Mar 13 '13 at 11:25
James P
8,26353047
8,26353047
answered Mar 13 '13 at 10:54
Alon Kogan
18112
18112
add a comment |
add a comment |
You might want to try clearing just your cache, and not your entire browsing, history, cookies, passwords, saved form data, and whatnot (the default).
In Firefox 3.5, go to
Tools » Clear Recent History...
Then make sure only "Cache" is selected before selecting "Clear Now."
In Chrome (don't know what particular version you're using, as I use the dev builds), go to
Wrench Icon (Tools) » Options » Personal Stuff tab » Clear browsing data...
Again, make sure only "Empty the cache" is checked.
Alternatively, you can try opening up a new Private session in Firefox or Incognito window in Chrome; neither should cache any files (including your .JS files) you automatically download and process when browsing.
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
add a comment |
You might want to try clearing just your cache, and not your entire browsing, history, cookies, passwords, saved form data, and whatnot (the default).
In Firefox 3.5, go to
Tools » Clear Recent History...
Then make sure only "Cache" is selected before selecting "Clear Now."
In Chrome (don't know what particular version you're using, as I use the dev builds), go to
Wrench Icon (Tools) » Options » Personal Stuff tab » Clear browsing data...
Again, make sure only "Empty the cache" is checked.
Alternatively, you can try opening up a new Private session in Firefox or Incognito window in Chrome; neither should cache any files (including your .JS files) you automatically download and process when browsing.
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
add a comment |
You might want to try clearing just your cache, and not your entire browsing, history, cookies, passwords, saved form data, and whatnot (the default).
In Firefox 3.5, go to
Tools » Clear Recent History...
Then make sure only "Cache" is selected before selecting "Clear Now."
In Chrome (don't know what particular version you're using, as I use the dev builds), go to
Wrench Icon (Tools) » Options » Personal Stuff tab » Clear browsing data...
Again, make sure only "Empty the cache" is checked.
Alternatively, you can try opening up a new Private session in Firefox or Incognito window in Chrome; neither should cache any files (including your .JS files) you automatically download and process when browsing.
You might want to try clearing just your cache, and not your entire browsing, history, cookies, passwords, saved form data, and whatnot (the default).
In Firefox 3.5, go to
Tools » Clear Recent History...
Then make sure only "Cache" is selected before selecting "Clear Now."
In Chrome (don't know what particular version you're using, as I use the dev builds), go to
Wrench Icon (Tools) » Options » Personal Stuff tab » Clear browsing data...
Again, make sure only "Empty the cache" is checked.
Alternatively, you can try opening up a new Private session in Firefox or Incognito window in Chrome; neither should cache any files (including your .JS files) you automatically download and process when browsing.
edited Sep 5 '09 at 2:38
answered Sep 5 '09 at 2:27
RoyalKnight
36127
36127
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
add a comment |
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
Incognito is probably the way to go for Chrome.
– mdoar
Aug 26 '10 at 23:04
add a comment |
I've been using a little trick on a site that I'm working on...for the same reasons as you. I make small changes and have JavaScript code loaded by JavaScript code and want to make sure that I'm always working with the current (non-cached) script.
Try making the JavaScript code you are loading into a PHP file...simply put <?php ?> at the beginning and put on the ext of .php.
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
// The Date added to the file doesn't effect the results but
// helps Internet Explorer be sure to refresh the data and
// not use cache
var d = new Date();
var t = d.getTime();
fileref.setAttribute("src", filename + ".php?date=" + t);
fileref.setAttribute("id", filename);
Because the name changes, Internet Explorer thinks it is a new file ;)
1
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
1
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
add a comment |
I've been using a little trick on a site that I'm working on...for the same reasons as you. I make small changes and have JavaScript code loaded by JavaScript code and want to make sure that I'm always working with the current (non-cached) script.
Try making the JavaScript code you are loading into a PHP file...simply put <?php ?> at the beginning and put on the ext of .php.
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
// The Date added to the file doesn't effect the results but
// helps Internet Explorer be sure to refresh the data and
// not use cache
var d = new Date();
var t = d.getTime();
fileref.setAttribute("src", filename + ".php?date=" + t);
fileref.setAttribute("id", filename);
Because the name changes, Internet Explorer thinks it is a new file ;)
1
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
1
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
add a comment |
I've been using a little trick on a site that I'm working on...for the same reasons as you. I make small changes and have JavaScript code loaded by JavaScript code and want to make sure that I'm always working with the current (non-cached) script.
Try making the JavaScript code you are loading into a PHP file...simply put <?php ?> at the beginning and put on the ext of .php.
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
// The Date added to the file doesn't effect the results but
// helps Internet Explorer be sure to refresh the data and
// not use cache
var d = new Date();
var t = d.getTime();
fileref.setAttribute("src", filename + ".php?date=" + t);
fileref.setAttribute("id", filename);
Because the name changes, Internet Explorer thinks it is a new file ;)
I've been using a little trick on a site that I'm working on...for the same reasons as you. I make small changes and have JavaScript code loaded by JavaScript code and want to make sure that I'm always working with the current (non-cached) script.
Try making the JavaScript code you are loading into a PHP file...simply put <?php ?> at the beginning and put on the ext of .php.
var fileref = document.createElement('script');
fileref.setAttribute("type", "text/javascript");
// The Date added to the file doesn't effect the results but
// helps Internet Explorer be sure to refresh the data and
// not use cache
var d = new Date();
var t = d.getTime();
fileref.setAttribute("src", filename + ".php?date=" + t);
fileref.setAttribute("id", filename);
Because the name changes, Internet Explorer thinks it is a new file ;)
edited Dec 8 at 20:30
Peter Mortensen
8,331166184
8,331166184
answered Sep 16 '09 at 14:30
Greg
1
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
1
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
add a comment |
1
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
1
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
1
1
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
Doesnt need to change the name to '.php'. If you put 'filename.js?t='+t the result is the same. You can do it with '.css' too. All ours production systems use this trick to certify that the clients uses the right content files.
– Leonel Martins
Sep 21 '09 at 13:17
1
1
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
As a note, we tend to use the SVN revision number instead of date/time. That way we get caching benefits, and refresh only when we actually commit.
– Groo
Jan 21 '11 at 13:50
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
Thanks so much! This trick totally slipped my mind. I've been battling this issue for days and this'll do it for me. I just put this at the end of the url: "?<?php echo time() ?>"
– thrashr888
Mar 17 '11 at 16:34
add a comment |
In Chrome you can just press Ctrl and click the refresh button. I discovered this by chance.
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
add a comment |
In Chrome you can just press Ctrl and click the refresh button. I discovered this by chance.
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
add a comment |
In Chrome you can just press Ctrl and click the refresh button. I discovered this by chance.
In Chrome you can just press Ctrl and click the refresh button. I discovered this by chance.
edited Dec 8 at 20:31
Peter Mortensen
8,331166184
8,331166184
answered Aug 7 '11 at 13:36
Julio Bahar
111
111
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
add a comment |
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
This does a hard refresh of the entire page, I don't think this just refreshes Javascript only.
– Ivo Flipse♦
Aug 7 '11 at 13:56
add a comment |
I open the JavaScript file in a separate tab, Shift + refresh, verify that I'm seeing the latest changes, then Shift + refresh the actual page (actually, in my case, frame in a frameset, which seems to make matters worse). This works almost all the time.
add a comment |
I open the JavaScript file in a separate tab, Shift + refresh, verify that I'm seeing the latest changes, then Shift + refresh the actual page (actually, in my case, frame in a frameset, which seems to make matters worse). This works almost all the time.
add a comment |
I open the JavaScript file in a separate tab, Shift + refresh, verify that I'm seeing the latest changes, then Shift + refresh the actual page (actually, in my case, frame in a frameset, which seems to make matters worse). This works almost all the time.
I open the JavaScript file in a separate tab, Shift + refresh, verify that I'm seeing the latest changes, then Shift + refresh the actual page (actually, in my case, frame in a frameset, which seems to make matters worse). This works almost all the time.
edited Dec 8 at 20:31
Peter Mortensen
8,331166184
8,331166184
answered Jun 20 '12 at 15:41
doug mayo-wells
111
111
add a comment |
add a comment |
I've not used it myself, but the Firefox Add-on "Clear Cache Button" might be of use. I read through their documentation, so I'm not sure if it clears your browsing history too.
add a comment |
I've not used it myself, but the Firefox Add-on "Clear Cache Button" might be of use. I read through their documentation, so I'm not sure if it clears your browsing history too.
add a comment |
I've not used it myself, but the Firefox Add-on "Clear Cache Button" might be of use. I read through their documentation, so I'm not sure if it clears your browsing history too.
I've not used it myself, but the Firefox Add-on "Clear Cache Button" might be of use. I read through their documentation, so I'm not sure if it clears your browsing history too.
answered Sep 5 '09 at 2:23
Jared Harley
11.3k33249
11.3k33249
add a comment |
add a comment |
Go to content settings in Chrome, disable JavaScript and save.
Then, enable JavaScript again.
add a comment |
Go to content settings in Chrome, disable JavaScript and save.
Then, enable JavaScript again.
add a comment |
Go to content settings in Chrome, disable JavaScript and save.
Then, enable JavaScript again.
Go to content settings in Chrome, disable JavaScript and save.
Then, enable JavaScript again.
edited Feb 22 '13 at 15:05
slhck
159k47441464
159k47441464
answered Feb 22 '13 at 14:23
nisar
1
1
add a comment |
add a comment |
If you are working with JavaScript and worried about reloading the page to reflect JavaScript changes. Try to use the Chrome debugger, where you can make changes to your loaded JavaScript file(s) at run time and without using any reload can test new functions or changes you want to test.
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
add a comment |
If you are working with JavaScript and worried about reloading the page to reflect JavaScript changes. Try to use the Chrome debugger, where you can make changes to your loaded JavaScript file(s) at run time and without using any reload can test new functions or changes you want to test.
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
add a comment |
If you are working with JavaScript and worried about reloading the page to reflect JavaScript changes. Try to use the Chrome debugger, where you can make changes to your loaded JavaScript file(s) at run time and without using any reload can test new functions or changes you want to test.
If you are working with JavaScript and worried about reloading the page to reflect JavaScript changes. Try to use the Chrome debugger, where you can make changes to your loaded JavaScript file(s) at run time and without using any reload can test new functions or changes you want to test.
edited Dec 8 at 20:32
Peter Mortensen
8,331166184
8,331166184
answered Dec 20 '16 at 12:31
Nikhil Joshi
11
11
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
add a comment |
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
Welcome to Super User! Please read the question again carefully. Your answer does not answer the original question.
– DavidPostill♦
Dec 20 '16 at 13:42
add a comment |
In the latest Chrome it is available:

Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
add a comment |
In the latest Chrome it is available:

Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
add a comment |
In the latest Chrome it is available:

In the latest Chrome it is available:

edited Dec 8 at 20:33
Peter Mortensen
8,331166184
8,331166184
answered Oct 31 at 8:21
Baljeetsingh
1778
1778
Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
add a comment |
Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
Some elaboration wouldn't be amiss.
– Peter Mortensen
Dec 8 at 20:34
add a comment |
Add some dynamic date function at the end of your JavaScript file. It will force the browser to load the updated JavaScript file. Meaning, when including the .js file you could add .... xyz.js?
< ? php echo date('l jS of F Y h:i:s A') ? >
Of course this could be removed once your debugging is done and ready to go live.
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
add a comment |
Add some dynamic date function at the end of your JavaScript file. It will force the browser to load the updated JavaScript file. Meaning, when including the .js file you could add .... xyz.js?
< ? php echo date('l jS of F Y h:i:s A') ? >
Of course this could be removed once your debugging is done and ready to go live.
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
add a comment |
Add some dynamic date function at the end of your JavaScript file. It will force the browser to load the updated JavaScript file. Meaning, when including the .js file you could add .... xyz.js?
< ? php echo date('l jS of F Y h:i:s A') ? >
Of course this could be removed once your debugging is done and ready to go live.
Add some dynamic date function at the end of your JavaScript file. It will force the browser to load the updated JavaScript file. Meaning, when including the .js file you could add .... xyz.js?
< ? php echo date('l jS of F Y h:i:s A') ? >
Of course this could be removed once your debugging is done and ready to go live.
edited Dec 8 at 20:35
Peter Mortensen
8,331166184
8,331166184
answered Oct 10 '12 at 11:02
Chris
91
91
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
add a comment |
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
This is not Javascript.
– Nathan Adams
Dec 12 '12 at 17:45
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f36106%2fforce-refreshing-only-javascript-files-in-firefox-and-chrome%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown