开发者

Chrome Extension: Open New Popup Window

开发者 https://www.devze.com 2023-02-14 12:35 出处:网络
Could someone shed some light on where this code is incorrect please <script> chrome.browserAction.onClicked.addListener(function(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.开发者_C百科getURL('redirect.html')}, function(window) {
            });
        });
    });
</script>

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


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) {
   });
});
0

精彩评论

暂无评论...
验证码 换一张
取 消