Chrome extension: create tab from within an iframe in popup-Collection of common programming errors
Your code is working without any changes, I have added working code as a reference; Where is your target source html page of iframe
, how did you reference it from browser action popup.? If this did not solve share how did you refer your iframe
from browser action popup.
manifest.json
Simple code, registered browser action
.
{
"name": "Iframe Holder",
"description": "http://stackoverflow.com/questions/14429598/chrome-extension-create-tab-from-within-an-iframe-in-popup",
"version": "1",
"manifest_version": 2,
"browser_action": {
"default_popup": "popup.html",
"default_title": "Iframe."
}
}
popup.html
Included destination page in popup
of browser action.
iframe.html
Used your code and eliminated not related css files etc
iframe.js
Used your code with no modifications
$(document).on("click", '.new_tab_bt', function () {
openNewTab();
});
function openNewTab() {
chrome.tabs.create({
url: "https://www.google.com"
});
}