Debugging Cache Scripts

I am working on a front-end project (JavaScript files), and the server adds a caching value to the end of the URL, for example http://www.example.com/myfile.js&bust=0.5647534393

My problem is that I lost all the breakpoints set in the Chrome developer tools after rebooting. I do not have access to the server to disable it.

Is there a way around this limitation?

UPDATE: adding a debugger; in source code, JS is not a viable solution because I am debugging production code.

+9
javascript google-chrome-devtools
source share
2 answers

You can use the Chrome plugin to rewrite URLs like Requestly (not free) or Redirector (free), and add a redirect rule for your scripts.

For example, using a query, you can specify rules such as:

Requestly rule screenshot

I assume that if you ?bust=xxxx part of ?bust=xxxx from the URL, the server will still serve the correct script file. I tested it and it works like a charm in my local test environment - breakpoints remain.

Hope it helps.

+6
source share

You can use debugger; in your code. If the developer console is open, execution aborts. It also works in firebug.

+1
source share

All Articles