fftoolbar
fftoolbar

Reputation: 175

Open links in new tab in Firefox

I am developing an Firefox extension. How can all the links on a webpage to be opened in a new tab?

Upvotes: 2

Views: 1211

Answers (3)

fftoolbar
fftoolbar

Reputation: 175

I found what I was after. I wanted gbrowser.addtab(this.href).

Upvotes: 1

Mark Mayo
Mark Mayo

Reputation: 12585

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.

Upvotes: 4

powtac
powtac

Reputation: 41050

Press Ctrl while clicking on the link on Windows. Use cmd on OSX.

Upvotes: -3

Related Questions