hy folks

after trying to find out how to do this for the whole day,
i'm not quite at the point where i could say i know how it works.

so i'm asking you kindly to help me a bit.

i just wonder how to load and display a page "manually" - using
xpconnect. i'know it might seem silly, there are probabl easier
ways to do this... anyways: it should be possible, shouldn't it ?

here is my try:

--- BEGIN dummy.html ---
<HTML><HEAD><TITLE>A Page
</TITLE><SCRIPT src="dummy.js"></SCRIPT></HEAD>
<BODY><FORM><INPUT type=button value=push onclick="func();"></FORM>
<A href="http://localhost.localdomain/";>http://localhost.localdomain/</A>
</BODY></HTML>
--- END ---

--- BEGIN dummy.js ---
function func() { try {

        netscape.security.PrivilegeManager
                .enablePrivilege("UniversalXPConnect");

        var uri = Components.classes
                ["@mozilla.org/network/standard-url;1"]
                .createInstance(Components.interfaces.nsIURI);

        var phand = Components.classes
                ["@mozilla.org/network/protocol;1?name=http"]
                .createInstance(Components.interfaces.nsIProtocolHandler);

        var dolofa = Components.classes
                ["@mozilla.org/content-viewer-factory/view;1?type=text/html"]
               .createInstance(Components.interfaces.nsIDocumentLoaderFactory);

        var container = Components.classes["@mozilla.org/webshell;1"]
              .createInstance(Components.interfaces.nsIContentViewerContainer);

        uri.spec = "http://www.mozilla.org/";;

        var channel = phand.newChannel(uri),
            listener = new Object(), viewer = new Object();

        dolofa.createInstance("view", channel, null,
                              "text/html", container, null, listener, viewer);

        channel.asyncOpen(listener.value, viewer.value);

//      container.embed(viewer, "view", null);

} catch (e) { alert(e); } }
--- END ---

This loads the page, and if you uncommand container.embed() -
the browser freezes - why ? - if you pass null instead of "view",
it even crashes. anyway: it loads - so how do i display it ?

thank you for your help

regards

pat - patrickpfeifer at netscape dot net

Reply via email to