Chrome Extension: onclick extension icon, open popup.html in new tab

后端 未结 3 1449
夕颜
夕颜 2020-12-09 03:50

I have created a chrome extension and managed to open the popup.html file using window.open. however I want to open it in a new tab, I\'ve tried lo

3条回答
  •  余生分开走
    2020-12-09 04:30

    why would you want to open the popup.html in a new tab? You should create a different page for that. Anyways, if you want to open up the popup.html, in a new tab, you would need to pass in the extension url.

    http://code.google.com/chrome/extensions/extension.html#method-getURL

    chrome.tabs.create({'url': chrome.extension.getURL('popup.html')}, function(tab) {
      // Tab opened.
    });
    

提交回复
热议问题