Reputation: 44842
I'm making a Chrome Extension and need to view the HTML/CSS/JS of the popup.html
.
I can't right click to inspect elements. Is there another way? I need to make sure CSS and JavaScript is being inserted correctly. How to debug a problem in that popup file?
Upvotes: 80
Views: 32265
Reputation: 167
One way to get the popup.js to be debugged is to let it first do its popup by pressing the extension icon at the tool bar. Then right click the popped window to get "Inspect" choice and the developer window opens. But then you need to be able to reload the page to get initial javascript breakpoints to work. At that developer page find Sources->Page then right click: Select 'Open in new tab'. Then open Devtools on that new full page and you can reload:
Upvotes: 1
Reputation: 1250
Try switching Auto-open DevTools for popups in the bottom right of DevTools Settings:
Another good way to inspect Javascript being part of the extension popup is adding special comments to the end of the script to be debugged:
// @sourceURL=popup.js
This is de-facto a directive for DevTools to include this specific file into Sources tab. From there you can inspect code, add breakpoints, output to console, etc. as usual.
Upvotes: 2
Reputation: 1782
Perhaps another way may be to find the ID: for your application in chrome://chrome/extensions/
You can then load your popup in a regular window by
chrome-extension://id_of_your_application/popup.html
Exchange popup.html for the file you have specified in manifest.json under "default_popup" property.
Upvotes: 40
Reputation: 1828
Inspect Popup has gone away with the latest build.
Here's how I debug Chrome Extension Popups.
debugger
statements.location.reload(true)
and press enter.Now your breakpoints are hit! Great way to reload changed scripts without revisiting the Extension page.
Upvotes: 108
Reputation: 64
Yes, 'Inspect Popup' on the extension icon, and apart from that - from extension manager you can also inspect your options page.
Upvotes: 2