What’s the best way to debug custom User Scripts (aka Greasemonkey) in Chrome? Is there a way to enable User Script tracking in the Developer Tools?
What’s the best way to debug custom User Scripts (aka Greasemonkey) in Chrome? Is
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
What kind of debugging do you want? Like Alex said, user scripts will be listed in the same context as debugging the page itself. If you go to the “scripts” tab in the developer tools, you’ll see a bar with a dropdown which will allow you to select the appropriate javascript file you wish to debug. Such scripts should have urls that look like
chrome-extension://<hash>/<script file>.js. Those scripts will also log to the console of the page they’re embedded on.Additionally, if you want to log in the same place for all pages, you can try building your script as a full chrome extension, using the user script as a content script. Then you can send a message from your content script to your background page and log there. For example, if this were your content script:
And this were your background page:
You would see each load of the content script in the background page’s log.