Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome Extension: Open New Popup Window

Could someone shed some light on where this code is incorrect please

<script>
    chrome.browserAction.onClicked.addListener(function(window) {
        chrome.windows.onCreated.addListener(function(enumerated string ["popup"]) {
            chrome.windows.create({'url': chrome.extension.getURL('redirect.html')}, function(window) {
            });
        });
    });
</script>

I'm trying to achieve that when the extension is clicked on a new popup window will load.

like image 571
itsdaniel0 Avatar asked Mar 03 '11 20:03

itsdaniel0


1 Answers

You don't need a listener, just create it right away:

chrome.browserAction.onClicked.addListener(function() {
   chrome.windows.create({'url': 'redirect.html', 'type': 'popup'}, function(window) {
   });
});
like image 86
serg Avatar answered Oct 02 '22 16:10

serg