Skip to content

Instantly share code, notes, and snippets.

@wbamberg
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbamberg/e4e6fc5dae051e0e5a47 to your computer and use it in GitHub Desktop.
Save wbamberg/e4e6fc5dae051e0e5a47 to your computer and use it in GitHub Desktop.
var tabs = require("sdk/tabs");
var { viewFor } = require("sdk/view/core");
function onOpen(tab) {
let xulTab = viewFor(tab);
let contentWindow = xulTab.ownerDocument.defaultView;
contentWindow.addEventListener("hashchange", logHashChange, false);
}
function logHashChange(tab) {
console.log(tabs.activeTab.url);
}
tabs.on('open', onOpen);
tabs.open("https://google.ca");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment