Mickael MAINDRON wrote:

> Hi guys !
> 
> I'm a complete beginer with XUL/XPCOM, and I'm trying to make an
> application that opens new browsers tabs dynamically.
> I searched in documentation and also had a look into some Mozilla's jar
> (browser.jar, etc.). I've found some indications, but I didn't succeed
> in it (working with XULDocument for example).
> Does anybody can point me on the right way :)
> 
> TIA,
> 
> -- Mike

The following code should be of some help to you.

var browser = getBrowser();
var referrer = Components.classes["@mozilla.org/network/simple-uri;1"].
                       createInstance(Components.interfaces.nsIURI);
var tab = browser.addTab("http://localhost/",referrer,"utf-8";);

It will have to be run the the same scope as the browser window you are
adding a tab to. I don't think you will be able to get at the browser
object from outside this scope, as it is not an xpcom component it is an
xbl binding.

The code for browser object can be seen at 
http://lxr.mozilla.org/seamonkey/source/xpfe/global/resources/content
bindings/tabbrowser.xml

Joe
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to