Search code examples
google-chrome-extension

How to programmatically open chrome extension popup.html


I have a created a desktop notification using google extension which works great:

icon = '';
    var popup = window.webkitNotifications.createNotification(my notification');
            icon, 'Awesome title', 'Click here to view more. ');
    popup.show();

Is there a way to launch the actual google extension popup.html (as shown on the image below), when the user click on the the desktop notification?

The popup.html The desktop notification

Thanks.


Solution

  • Short answer is that you can't, but if you want to open the popup in a new tab instead, this is how you would do it:

    Put this before you call show

    popup.onclick = function() { 
        chrome.tabs.create({url : "popup.html"}); 
        popup.cancel();
    }