i'm injecting a js file to every page in google chrome via
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.executeScript(null,{file:"js/content.js"},function(resultArr){
console.log(resultArr);
});
});
content.js
console.log("hello stackoverflow");
I can see hello stackoverflow
printed in the console of the webpage. But i'm not able to find the source file, so i can debug it. Any idea how?
In Chrome, navigate to Tools > Advanced > Error Console. The error console will open. Select JavaScript and Errors from the two drop downs. To find the error location, expand one of the errors.
Use the debugger
keyword. This is like inserting a breakpoint into your JS code
so in content.js
debugger;
console.log("hello stackoverflow");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With