window.addEventListener("click", (e) => {
window.open("https://example.com", "myPopup", "height=400,width=400");
});browserSettings.allowPopupsForUserEvents / notebook
browserSettings.allowPopupsForUserEvents
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
function toggleAllowPopup() {
function toggle(current) {
console.log(`Current value: ${current.value}`);
browser.browserSettings.allowPopupsForUserEvents.set({
value: !current.value,
});
}
browser.browserSettings.allowPopupsForUserEvents.get({}).then(toggle);
}
browser.browserAction.onClicked.addListener(() => {
toggleAllowPopup();
});