Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clear cached JavaScript includes in Firefox

Tags:

I'm working on JavaScript for a site, developing with Firefox, and when I refresh the page, I don't see my changes. The JavaScript file is in an external file. I reloaded and refreshed the page several times, but the old JavaScript file was still cached. Finally, I loaded the JavaScript page in the browser directly, saw the old script, hit 'reload', and saw my changes.

How can I clear cached external JavaScript files? I'll need to know this also when I tell the client that the changes are made, so that they aren't seeing the old cached functionality.

like image 946
user151841 Avatar asked Jan 12 '11 15:01

user151841


People also ask

Does Firefox cache JavaScript?

As long as the app hasn't changed, the tag will stay the same and therefore the query string will also. The browser should cache the JS and not do a network request at all because the expire date is far future. Each time the app is updated, that query string will change and the browser should download it.

How do I refresh JavaScript in Firefox?

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.

How do I clear my browser cache in JavaScript?

1 Right-click on the Screen. 2 Click on Inspect. This will open dev tools. 3 Then right click on the Refresh like icon and then click on Empty Cache and Hard Reload for clearing all cache and hard reload for loading fresh content along with static content like CSS, js, images, etc.


1 Answers

  • The web developer toolbar add-on has an option to let you disable caching.
  • Firebug also does this. It is in the menu of the Net panel and is called Disable Browser Cache.

To bypass cache for one time in Firefox:

  • Click the reload button while holding the shift key.
  • Ctrl+F5
  • Ctrl+Shift+R or Cmd+Shift+R
  • for other browsers

Some web hosting services do cache the page server-side. When bypassing cache, web browsers will send a header to tell the server that it should not respond with the cached data.

like image 157
Thai Avatar answered Oct 02 '22 12:10

Thai