I am developing an Firefox extension. How can all the links on a webpage to be opened in a new tab?
I'm pretty sure that Firefox extensions can't press keys on the keyboard (unless hooked into something like a USB robot!)
David Dorward
2009-11-11 17:12:54
or press the scroll button on your mouse
Jason
2009-11-11 17:12:58
It's not that he wants to do it as a user - he wants code in his extension that does it as part of the app...
Mark Mayo
2009-11-11 17:14:43
Maybe he don't know that this is a build in feature...
powtac
2009-11-11 23:12:08
Thank you all but u guys are not hitting the chord... you know what i mean... like in greasemonkey u can open a given link on any webpage (not a website hosted by me) any general one... So in greasemonkey i can do the following:link.addEventListener('click',function(e){ e.stopPropagation(); e.preventDefault(); GM_openInTab(this.href);},false);Would anyone know a code equivalent to this for extension developement?
fftoolbar
2009-11-12 00:57:17
Ok, I think you are very close! Just check out this pages: http://tools.w3clubs.com/ext/ http://ted.mielczarek.org/code/mozilla/extensiondev/
powtac
2009-11-12 01:10:26
+2
A:
That's usually a configurable option in Firefox to handle new links, so they may override your extension with that.
However...
The code
<a href="http://www.example.com/"> Example Website</a>
will allow you to click the appearing words [Example Website], and the link will open in the current window.
The code
<a href="http://www.example.com/" target="_blank"> Example Website</a>
Opens the link in a new window/tab.
The only mildly dodgy thing is that target is now apparently deprecated by the W3C, which means that it's generally up to the browser ( and the user's preferences) as to how (or even if) it is handled. But for people who have their preferences set accordingly - in Firefox - that should work.
Mark Mayo
2009-11-11 17:13:19