Open MurzNN opened 9 years ago
You can use Custom Buttons extension with following code:
if(gURLBar.value) {
privateTab.readyToOpenTabs(true);
setTimeout(function() {
privateTab.stopToOpenTabs(); // Turn off even if tab wasn't opened
}, 10);
var goBtn = document.getElementById("urlbar-go-button");
goBtn.dispatchEvent(new MouseEvent("click", {
bubbles: true,
cancelable: true,
view: window,
button: 1
}));
}
This is middle-click emulation on built-in Go button (+ code to make new tab private).
Or more simple (but probably more robust) way:
var typed = gURLBar.value;
if(typed) {
gBrowser.selectedBrowser.userTypedValue = null;
privateTab.readyToOpenTab(true);
gBrowser.selectedTab = gBrowser.addTab(typed);
}
To just open URI (e.g. "search string with spaces" and keywords like "g search" to search using Google will not work).
@MurzNN You can also simply create a bookmark shorcut like this: https://i.imgur.com/3DVgEhH.png
If you type "p example.com", http://example.com is going to open in a new private tab.
I use feature "Open new tab from URL bar" and type urls without opening new tab. Will be good to get the button right of URL bar for open typed text in url bar in new private tab, can you add it? Thanks.