Skip to content

Instantly share code, notes, and snippets.

@autonome
Created December 12, 2010 02:23
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 autonome/737796 to your computer and use it in GitHub Desktop.
Save autonome/737796 to your computer and use it in GitHub Desktop.
CommonJS module for Jetpack that allows you to set the URI to load when a new tab is opened.
exports.setURI = function setURI(uri) {
let window = require("window-utils").activeWindow;
// Make BrowserOpenTab point to the new tab uri instead of about:blank
window.eval(window.BrowserOpenTab.toSource().replace(/about:blank/g, uri));
// Clear out the new tab url
window.eval(window.URLBarSetURI.toSource().replace(/}$/, 'if (gURLBar.value == "' + uri + '") gURLBar.value = ""; $&'));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment