Skip to content

Instantly share code, notes, and snippets.

@quasicomputational
Created January 22, 2019 21:26
Show Gist options
  • Save quasicomputational/ec09c7c71ea6bbfa2be513c67fa7c8a9 to your computer and use it in GitHub Desktop.
Save quasicomputational/ec09c7c71ea6bbfa2be513c67fa7c8a9 to your computer and use it in GitHub Desktop.
browser.browserAction.onClicked.addListener(() => {
browser.tabs.query({ active: true })
.then((tabs) => {
for (tab of tabs) {
browser.tabs.update(tab.id, { url: "/test.html" });
}
});
});
{ "manifest_version": 2
, "name": "Test"
, "version": "1.0"
, "browser_action":
{ "browser_style": true
, "default_icon": "icon.svg"
}
, "background":
{ "scripts": ["background.js"]
}
, "permissions":
[ "activeTab"
]
}
<!DOCTYPE html>
<script src=test.js></script>
window.location.replace("https://example.com");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment