Chrome doesn't recognize my changes on my javascript file and loads old code?

Related searches

I have been sitting here for almost an hour here to test the website I'm building. Since I wanted to see the new changes from my code I reloaded, but it was reloading old one. I opened the devetools to hard reload and empy cache hard reload, they both load my old code. I went to incognito mode and it did the same thing. I went to devtools again to disable the cache from the settings and checked the disable cache in the network tab; it still cache my old code. Add-ons to clear the cache didn't work as well. Man, I haven't had this problem before and it only happened last night and it's worst today.

I'm so lost now since chrome doesn't load my new changes from my javascript file. Is there a solution for this?

One solution for this problem is to force reloading the resource in order to avoid the cache. You can get this modifying the url with http get parameters:


<script src="myscripts.js"></script>


<script src="myscripts.js?newversion"></script>

Where newversion can be any string as it will be ignored. A useful option is to use the date, or version, of your code.

I found this workaround particularly useful when I came across this same problem and wanted to ensure that all clients (not just my own browser!) would run the new version of the code.

Chrome is not working - Google Chrome Community, My internet is working fine because older version of chrome and other browsers work fine. I am attaching the screenshot showing that it doesn't� Get more done with the new Google Chrome. A more simple, secure, and faster web browser than ever, with Google’s smarts built-in. Download now.

I think there's an even better way:

You can use PHP to add the last modification date of your JavaScript file to the URI of that file.

<script src="js/my-script.js?<?php echo filemtime('js/my-script.js'); ?>"> 

The browser will receive:

<script src="js/my-script.js?1524155368"></script>

The URI of the file will automatically change if the file is updated.

This way the browser can still cache unchanged files while recognizing changes instantly.

Why won't Google Chrome open? 4 ways to troubleshoot, If Google Chrome won't open on your PC or Mac, it can usually be fixed using several troubleshooting methods. I turned off all extensions, reset default browser settings and uninstalled and reinstalled chrome. However, it still doesn't work.

Are you using any type of compilation tools (like gulp or grunt)? It's possible that there is an error in your code, and the tool is not compiling the updated code.

Otherwise, the solution @airos suggested should work. Appending any unique query string to the reference of your JS will always serve a fresh copy on first reload (since the browser will be caching a new URL).

Full Fix: Google Chrome not responding / not working, In this brief tutorial will show you how to fix Google Chrome not working on Windows 10. This Duration: 2:48 Posted: Dec 8, 2016 The latest frustration: I can't access Google Chrome anymore. Try to download and it disappears, icon won't open it, etc. The icon disappeared. I refuse to use Edge. It's not reliable and has none of my info on it. I want Chrome. it works. Edge doesn't. How do I get Chrome back?? It's not on the Store.

How To Fix Google Chrome Won't Open/Load Problem [Tutorial , Issues related to Google Chrome and Web pages that won't load can be caused by problems with your Internet connection or with the browser itself. Determine� In the Google Chrome Properties dialog, go to Security tab and tap on Advanced. Step 4: When the " Advanced Security Settings for Google Chrome " window pop up, tap Change button. Step 5: Type your username in the box under Enter the object name to select , click on Check Names OK button.

Google Chrome Won't Load Web Pages, Chrome, like many others apps on Windows 10, makes some changes to the Windows registry when you install it. These changes are essential for Chrome to run. The browser has a neat reset feature that can reset everything back to their default value should anything break. That said, the reset doesn’t appear to fix everything.

Chrome is quite adept at keeping you logged into sites even after a re-launch. If it doesn't work normally, read on to learn how to get that functionality back.

  • open the file from the devtools and check if it's the current, that will open the last version of it and update the cache. if it's the old one, then it's not cached, you've just not saved/exported/moved the file to the folder you're reading it from.
  • <script src="script.js?12213123"></script>
  • If all that still loads the old code, my guess is that the server is serving the old code.
  • also, while building, disable cache in the webserver and disable nginx or any other similar cache thing.
  • (For future reference, Ctrl+F5 is faster for force refreshing and not loading from cache)
  • Thanks! It is finally recognising my new changes. I thought I would sit here for another an hour try to fix it myself. I appreciate the help :)
  • You are welcome. Thanks for accepting the answer :-)
  • This is definetely a hack, as the server should always send you the new file is the file changed. The problem should be solved from the server.
  • No, I'm only using devtools to check what's happening sometimes on my code. I don't see any error when I checked it awhile ago.
  • Are you making the updates in devtools as well? Did you try the solution @airos suggested?
  • Yeah, I used his solution. Also, thanks for helping and replying to this thread.
  • This was my issue, npm had crashed and nothing was being recompiled, old code was still running. That was confusing.