How we can access the content of Javascript code that is in the code of a web page in a browser extension? I want to have something like parsing the content of it in my extension.
Asked
Active
Viewed 59 times
0
-
1You can use chrome.debugger API with [CDP commands](https://chromedevtools.github.io/devtools-protocol/) like getResourceTree and getResourceContent. In the simpler case of a globally exposed function you can call its .toString() method in [page context](https://stackoverflow.com/a/9517879). – wOxxOm Jan 23 '20 at 12:06
-
Thanks a lot, with getResourceContent, can I read the JS code of the page and decide according to its content? – Jan 23 '20 at 12:22
-
Why not? Why do you ask? – wOxxOm Jan 23 '20 at 12:22