JJin
JJin

Reputation: 327

Debugging tool for Chrome Extension notification window

I created a notification window using the Chrome Extension API:

var notification = webkitNotifications.createHTMLNotification("notification.html");
notification.show();

Also there is an external notification.js for all the scripts I would like to run in the notification window (Since the manifest version 2 discourages inline javascript). Everything works fine except I couldn't open developer tools for the notification window to inspect the page. I can do it for the background as well as the popup pages, so not sure if I didn't find it or I simply can't inspect notification through the developer tool. I know I can send messages between background and notification so that outputs show up on the console, but it would be nice if I could inspect directly.

Thanks much!

Upvotes: 4

Views: 2215

Answers (2)

Alvin Wong
Alvin Wong

Reputation: 12440

Navigate to chrome://inspect/ and you can see all the pages that can be inspected. Under the section "Extensions" you should be able to see your notification page and you can inspect it.

Adding this answer for completeness, because @JJin's answer may had been working before but not in Chrome versions 24 and 25.

Upvotes: 5

JJin
JJin

Reputation: 327

After some experimenting I accidently found that the developer tool is available for the notification page. The trick is to

  • fire up the notification window first and keep it on;
  • navigate to chrome://extensions and notification.html should appear alongside the background.html or whatever name the background page's name is,
    as shown in the screenshot:

enter image description here

Make sure the notification window is on otherwise the notification.html would disappear.

Upvotes: 0

Related Questions