Eric H. Jung wrote:

OK, so I have this to create a new, empty tab and then insert content:

var wm = Components
 .classes["@mozilla.org/appshell/window-mediator;1"]
 .getService(Components.interfaces.nsIWindowMediator);

var win = wm.getMostRecentWindow("navigator:browser");
win.gBrowser.selectedTab = win.gBrowser.addTab("about:blank");
var content = "<html><body><p>hello, wurld</p></body></html>";
var dom = new DOMParser().parseFromString(content, "text/xml"); win.gBrowser.selectedTab.appendChild(dom.documentElement);
selectedTab is an anonymous XUL element of the tabbrowser, you need to use win.gBrowser.getBrowserForTab to get an anonymous browser element, then you can use its contentDocument, but be aware that you can't add or remove the html or body elements. Maybe what you really want is win.gBrowser.addTab("data:text/html,<html><body><p>hello, world</p></body></html>");
_______________________________________________
Project_owners mailing list
[email protected]
http://mozdev.org/mailman/listinfo/project_owners

Reply via email to