Skip to content Skip to sidebar Skip to footer

How Do I Launch A Webpage From A Xul App Within Xulrunner?

What is the XULRunner equivalent of the following button handler? function launch_page() { var win = Components.classes['@mozilla.org/appshell/window-mediator;1'] .getS

Solution 1:

This works for now:

// first construct an nsIURI object using the ioservicevar ioservice = Components.classes["@mozilla.org/network/io-service;1"]
    .getService(Components.interfaces.nsIIOService);

var uriToOpen = ioservice.newURI("http://www.google.com/", null, null);

var extps = Components.classes["@mozilla.org/uriloader/external-protocol-service;1"]
    .getService(Components.interfaces.nsIExternalProtocolService);

// now, open it!
extps.loadURI(uriToOpen, null);

Anybody got a more standard way?

Post a Comment for "How Do I Launch A Webpage From A Xul App Within Xulrunner?"