Created
December 12, 2010 02:23
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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