Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Chrome's script debugger to reload javascript?

People also ask

How do I refresh JavaScript in Chrome?

Different operating systems and browsers use different commands or shortcuts. For Windows in Chrome or Edge, the keyboard shortcut Ctrl + F5 (or Ctrl + Reload) refreshes. For Mac, hold Cmd-Shift-R or Shift-Reload. Most browsers also have a refresh button next to the URL.

How do I refresh inspect in Chrome?

Whenever you are working chrome, try this: Press F12 and open the developer tools. On the refresh button, on the top left of the browser window, do a right click.


While you are developing your script, try disabling the Chrome cache.

When you reload the page, the JavaScript should now get refreshed.


Chrome circa 2011

Open settingsDisable the cache


Chrome circa 2018

Open settings Disable the cache

You can also access it on the network tab:

Network tab


enter image description here

The context menu shown above is accessible by right clicking / presssing & holding the "reload" button, while Chrome Dev Tools is opened.

Empty cache and hard reload works best for me.

Another Advantage: This option keeps all other opened tabs and website data untouched. It only reloads and clears the current page.


You can always clear a specific file by doing the following:

  1. Open Dev Tools
  2. Click on the Sources tab
  3. Find your script / image / file
  4. Check the right panel to see if your file is up to date

If not:

  1. Right click the resource in the left panel and choose 'Open Link in New Tab'
  2. Force a reload of the resource with the methods above. (See @Bishoy Hanna's example)

This is very handy if you have resources that are in frames and CTRL+F5 is not force refreshing them.


Shift+F5 quickly clears the cache.


Here's a shortcut to DevTools:

  1. F12 to open Chrome DevTools
  2. F1 to open DevTools Settings
  3. Check Disable cache (while DevTools is open) as shown below:

enter image description here

Note: Updated per Dimi's comment. They tend to move it so let me know or update the post if you notice that it's changed.


For Google chrome it is not Ctrl+F5. It's Shift+F5 to clear the current cache! It works for me !