Update: I’ve put up a new howto with new instructions for Firefox3.5 and 3.6 ans the new userChrome1.1.
When Firefox 3 started its beta program, I decided to give it a shot. Since then, I never came back to Firefox 2. Firefox 3 was faster, stronger, better 😉 than its predecessor. However, there was one point where Firefox 3 has some problems : extensions. Many extensions where not working anymore. While this is now fixed with many extensions updated, Firefox 3 includes the new « places » functionnality that replaces bookmarks, history etc… And this new functionality irremediately broke my custom userchrome.js for opening bookmarks in tabs (without midlle clicking, that is). Since I only open bookmarks in tabs, with was a little troublesome for me, but, being the only grip I had, I decided to live with it. Until today, where I finally figured out how to write a new « magic line » in my userchrome.js, thanks partly to tab mix, partly to google, and partly to my brain :).
So, here is the complete howto:
- How to open search box in a new tab. This one is easy, just open about:config (type about:config in url bar) and filter with « search ». Look for
browser.search.openintab
and put its value to « true ». Voilà, new tabs for search box (a must if you ask me, plus combo if you have the right search engines – i.e. not only google). - How to open urls in a new tab. This one as well bookmarks requires userchrome.js. This is a very small extension that allows javascripts snippets to be executed the same way you have userChrome.css styles added to a page. I used version 0.8, but I think 0.7 version works as well. So go on and download it, then create a userChrome.js file in your chrome folder (inside your user profile folder, look at the Chrome folder article and Profile folder article on MozillaZine if you need help). From this point, you can fill it directly with the code provided here or use the sub-script/overlay loader as in my own userchrome (allows the loading of other scripts). If you want, you can download my own userChrome.js directly and put it in the chrome folder. Now you can paste this code inside a .uc.js file in the same folder or inside userChrome.js:
eval("BrowserLoadURL = " + BrowserLoadURL.toString().replace("e;", "$& if ((gBrowser.currentURI.spec != 'about:blank' || gBrowser.webProgress.isLoadingDocument)) { var tab = gBrowser.addTab(); gBrowser.selectedTab = tab; }"));
This will open a new tab for url typed in url bar. You will have to restart your broswer to have the new behaviour.
- How to open bookmarks in new tab. This was the most difficult task since very few information is available on the internet. The key was using PlacesUIUtils for accessing functionnality. The code is:
eval("PlacesUIUtils.openNodeIn = " + PlacesUIUtils.openNodeIn.toString().replace("openUILinkIn(aNode.uri, aWhere);","if ((gBrowser.currentURI.spec != 'about:blank' || gBrowser.webProgress.isLoadingDocument) && (aNode.uri.indexOf('javascript:') == -1)) {openUILinkIn(aNode.uri, 'tab');}else{openUILinkIn(aNode.uri, aWhere);}"));
You will have to restart your broswer to have the new behaviour.
The whole OpenInTabs.uc.js is available if you want both functionality, just drop it into the same folder as userChrome.js. As a bonus, you can download ChromaTabs for Firefox 3 if you like colored tabs. If you have any question or remark, please leave a comment. Have fun with firefox 3 !
Update: If you want to have open in tab functionality for only some tabs, here are the shortcuts :
- Url and search : Press Alt+Enter to open in a new tab. With url you can combine Alt with the classic Ctrl(end in .com), Shift(in .net) and Ctrl+Shift(in .org). That is, google +Ctrl+Shift+Alt = www.google.org in a new tab.
- Bookmarks : Ctrl+Click on a bookmark opens it in a new tab.
Update: Now bookmarklets are supported.
Update 2009/03/01: For Firefox 3.1, the BrowserLoadUrl doesn’t exist anymore. There is new way to have correct behaviour:
(function() {
urlbar = document.getElementById("urlbar");
eval("urlbar.handleCommand = " + urlbar.handleCommand.toString().replace("&& aTriggeringEvent.altKey","&& !aTriggeringEvent.altKey"));
})();
This switch the Alt behaviour. If you want to open in the same tab, hold Tab, else, it will open automagically in a new tab (this is so easy that I’m asking myself why they did not include it as userpref). Have fun !
Sorry to flood this old post up… I dugg up an old extension (it was deactivated) and (re)discovered that it provides the « open into a new tab » option for « Action for entering URI in the location bar ». If anyone is interesting. It’s called TreeStyleTabBar and it’s a complete change to the tab interface… (More on this at http://piro.sakura.ne.jp/xul/_treestyletab.html.en )
Have fun customizing !
UGG Cardy
UGG Classic Cardy
UGG Boots 5819 Classic Cardy in Black
For some reason this isn’t working for me with the latest Firefox in Windows 7 :S
What does not work ? The web client ?
doesnt work for me either
followed instructions exactly
from the urlbar, firefox 3.5.5 still opens url in the same tab with ‘enter’ key
Hello-I’m really struggling to get this to work with FF3. I had it working in the past but my pc crashed(other reasons) and I had to reload the OS again. I have downloaded the new add-on userchromejs 1.1 and deleted the script it came with and replaced with your userchrome.js script but I can not get it to work. I’ve even put the openintab.jc script in the same userchrome.js file and still can not get it to work. What am I doing wrong? Im in the correct profile folder that contains the following:
userchrome.css
usercontent.css
userchrome.js
Can you run me through step by step?
your help is much appreciated.
@knackll
I’ve put new instructions with UserChromejs1.1. This was your problem I think. Please check the new article !
Great article! Thank you, buddy!
I hate FireFox opens bookmark in current tab, that make me dizzy anyway! And I can’t customize keyboard shortcuts to my favourite style. Hope FireFox can give more customization options in future versions.
Glad it helped you.
yes, good article 😉
I want to test comment on this blob