views:

58

answers:

3
+1  Q: 

HTML in new tab

Can someone explain to me how can I open a new tab from a firefox extension, that contains HTML content from a string I have?

A: 

I do not think this is possible:

  1. Whether or not a page or tab opens is based on the user's preferences. If the user has tabbed browsing disabled, the new content will be in a new window and not a tab.

  2. Each Browser tab requires a URL. So you would have to make a page, pass it the string as a query string or HTTP POST and then have that page return your string.

The other option is to use something like this.

Daveo
The question said **extension**; that goes a very long way towards avoiding being tied to user preferences for how links in web pages open.
David Dorward
A: 

I think this is what you need - https://developer.mozilla.org/en/XUL/tabs#m-appendItem

Ivo Sabev
+4  A: 

gBrowser.addTab, either using a data: URL, or opening and empty page then writing to its document. Info.

bobince