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 lots of different ways including:
<script type="text/javascript" language="JavaScript"> chrome.tabs.create('url': 'popup.html');
Am I just placing the code in the wrong place or is it the wrong code altogether?
If you don't want to use those extensions, then the most simple solution is to Ctrl + Click the link you think it's a pop-up: it will be open as a new tab.
For this, you have to hold the CTRL button and then click on the left mouse button while pointing the cursor to the web address. If you click on a link in this manner, the website won't open in your current tab; instead, you'll see a new tab with your preferred web page.
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. });
Now you can use Event Pages to open popup.html in new tab when extension icon is clicked without creating a default_popup page.
manifest:
"background": { "scripts": ["background.js"], "persistent": false }
js:
chrome.browserAction.onClicked.addListener(function(tab) { chrome.tabs.create({'url': chrome.extension.getURL('popup.html'), 'selected': true}); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With