function onCreated(windowInfo) {
console.log(`Created window: ${windowInfo.id}`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
browser.browserAction.onClicked.addListener((tab) => {
let creating = browser.windows.create({
url: ["https://developer.mozilla.org", "https://addons.mozilla.org"],
});
creating.then(onCreated, onError);
});windows.create() / notebook
windows.create()
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function onCreated(windowInfo) {
console.log(`Created window: ${windowInfo.id}`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
browser.browserAction.onClicked.addListener((tab) => {
let creating = browser.windows.create({
tabId: tab.id,
});
creating.then(onCreated, onError);
});function onCreated(windowInfo) {
console.log(`Created window: ${windowInfo.id}`);
}
function onError(error) {
console.log(`Error: ${error}`);
}
browser.browserAction.onClicked.addListener((tab) => {
let popupURL = browser.runtime.getURL("popup/popup.html");
let creating = browser.windows.create({
url: popupURL,
type: "popup",
height: 200,
width: 200,
});
creating.then(onCreated, onError);
});