Trick 17 with XUL and IE

And here is how you get the Mozilla control to work inside IE.

1. Unzip mozilla.zip to an appropiate location. The control is not part of the Mozilla or Firefox installer, so you need to get the zip file.

2. Open a command line.

3. cd into Mozilla's installation directory.

4. Run "regsvr32 mozctlx.dll" Important: Note the "x" in the filename. Do NOT register the other dll which name does not include an "x".

5. If your XUL Application requires elevated privileges (e.g. XPConnect), edit defaults/pref/browser-prefs.js and add this line:

pref("signed.applets.codebase_principal_support", true);

6. Create a HTML file:

<body onload="Browser1.Navigate('http://some.com/app.xul')"
style="padding: 0px; margin: 0px; overflow: none"><object
classid="clsid:1339B54C-3453-11D2-93B9-000000000000"
id="Browser1"
width="100%" height="100%"
style="padding: 0px; margin: 0px; border: 0px"
></object></body>


7. Put this HTML file on a web server you control. Now open IE's options and add that web server to the list of trusted sites. Otherwise, IE won't run the Mozilla control. Uncheck the "requires https connection" checkbox as needed.

8. Close all IE instances and restart it. Then open the HTML file. The Mozilla control should now be loading.

This has been tested with Mozilla 1.7.11, IE 6 on XP SP2 (German).

Also note that the Google toolbar apparently clashes with the Mozilla control. You need to deactivate it before you can use the Mozilla control. Otherwise IE will crash (probably a symbol conflict).

Our not-so-tiny XUL application seems to work fine except for these issues:

1. The prompts (e.g. password prompt) look funny.
2. Dialogs seem to be blocked, although the application disables Mozilla's popup blocker (dom.disable_open_during_load). I need to investigate that further.
3. There appears to be no way to open the Javascript console, because we are not running under chrome. Even when running our application using Browser1.Navigate("chrome://..."), openDialog does not appear to work.

Trackbacks

    No Trackbacks

Comments

Display comments as (Linear | Threaded)

  1. Avinash Prasad says:

    Hi Sascha.

    Your weblog above was very informative. I have been working with some apps I created in Firefox and have now gotten the need to port them to IE. While searching for quick solutions, I came across this page and am fascinated by the possibilities of running a Gecko engine within IE.

    I did manage to install the files and was able to open up a number of pages containing XUL within my IE7 browser. Most of the DOM events worked too as well as the calls to some XmlHttp requests I was making in my apps. However, I came across a problem in a few pages that rendered Flash. The browser crashed whenever it tried to open any pages that had flash (test www.youtube.com). I was wondering whether this was a known bug or something anyone knew how to fix. I also noticed that prompts and dialog boxes crashed the browser at times.

    I would appreciate any help I could get regarding these issues. Thanks again for your blog entry and this promises to save me a lot of time and effort during the application development process.

    Regards.
    Avinash :-)

  2. Peter says:

    Sasha.

    I installed XULRunner and registered the included mozctlx.dll. I can get the Mozilla control to render XUL from a remote URL as you've shown, but IE gives 'Unspecified Error' when I try to access resources locally in the chrome:
    e.g. Browser1.Navigate("chrome://path/to/some.xul").

    Did you somehow get this working? If so, what's the trick? And where does the control look for installed chrome resources. Am I running into some security restriction that prevents the mozctlx.dll control from accessing 'chrome://...' URLs?


Add Comment


Standard emoticons like :-) and ;-) are converted to images.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.
CAPTCHA 1CAPTCHA 2CAPTCHA 3CAPTCHA 4CAPTCHA 5