views:

53

answers:

3

I have an external JavaScript file and whether in FireFox or Chrome, whether all browsing data is cleared, it will NOT update no matter what. I believe something happened when I made a backup of my file, which I simply added "_thedate" to the end of the name. Then Save As back to the original name.

Now I cannot seem to get rid of the old JS no matter what unless I change the name of the file, which I really don't want to do, or add the script to the PHP page, which crowds it.

Anyone know the solution to this?

+1  A: 

You are sure you are linking to the same file and then editing that same file?

On some browser, you can use CTRL F5 to force a refresh.

Firebug also has a net tab with "Disable Browser Cache"

動靜能量
The CTRL+F5 might have worked. I haven't seen if I fixed it in a while, but I saw your suggestion and tried it. What does CTRL + F5 do that is different?
Tarik
CTRL-F5 ignores the cache when refreshing the page. But as far as Chrome goes, even that's sometimes not enough and one is forced to clear the cache in the preferences.
Ivo Wetzel
A: 

How about adding a '?2' to the tag?

<script src="a.js?2"></script>

The server should return the same file with or without the '?2', but the browser should see it as a different file and redownload. You can just change this query string whenever the file is changed.

adapted from: http://blog.httpwatch.com/2007/12/10/two-simple-rules-for-http-caching/

InsDel
A: 

Are you 100% sure your browser is even loading the script? Go to your page in Firefox and use the console in Firebug to check if the script has been loaded or not.

Glenn Nelson