Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replace remote JavaScript file with a local debugging copy using Greasemonkey or userscript

While debugging a client app that uses a Google backend, I have added some debugging versions of the functions and inserted them using the Chrome Developer Tools script editor.

However there are a number of limitations with this approach, first is that the editor doesn't seem to always work with de-minified files, and when the JS file is 35K lines long, this is a problem.

Another issue is that all the initialization that is done during load time, uses the original "unpatched" functions, hence this is not ideal.

I would like to replace the remote javascript.js file with my own local copy, presumably using some regex on the file name, or whatever strategy was suitable, I am happy to use either Firefox or Chrome, if one was easier than the other.

like image 467
Tom Avatar asked Oct 16 '11 02:10

Tom


1 Answers

There is one more tool Requestly - Chrome Extension which can be used to rewrite URLs and replace your production libraries with local hosted libraries with much easy setup and very friendly interface.

Have a look at this:

enter image description here

PS: I know this was answered but I still answered this considering it will be very beneficial to future readers.

like image 96
Sachin Avatar answered Oct 06 '22 13:10

Sachin