I tried for a long time, to map the network resource (.js file) with local resource (local .js file) using workspace mapping, but this didn’t work…
I’ve used this method with apps hosted on localhost, but then too it used to be mapping of entire root directory and not individual files…
Anyways, looks like this is allowed only for files coming from localhost…
Here are some other ways that I haven’t tried yet:
The Resource Override extension allows you to do exactly that:
- create a file rule for the url you want to replace
- edit the js/css/etc in the extension
- reload as often as you want 🙂
If you have the file prettified, Chrome will not allow edits. I turned it off and was able to edit. Willing to bet this is/was your problem.
It has some limitations:
- has to be a JS file. can’t be embeded tags in a html page.
- it cannot be prettified.
CHANGE THE ENTIRE FUNCTION IN CONSOLE
I don’t know if you need this to save permanently, but if you need to just temporarily modify the js:
for instance, if the page has:
I can take the content between the script, edit it, then enter it into the debugger like:
and it will work for me.
Or if you have like,
You can just enter
and foo will be redefined.