Single-File App with Xulrunner - Possible

Single-file app with xulrunner - possible?

I don't believe you could ever create single-file XULRunner applications. The -chrome <...> parameter probably used to work, I guess the "Remote XUL" error comes from the fact that the URL is file://, not chrome://.

You could use something like the Live XUL Editor in the Developer Assistant (formerly Extension Developer's extension) to test XUL quickly.

The general idea I hear these days is that you should write HTML5 instead, whenever you can, since it is more actively developed, more well-known technology with less incompatible changes and better tooling...

Simple XULRunner app to load a web page

I found the answer. Here is one one way to do it.

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="Konami Browser" width="800" height="600"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<browser type="content" src="http://google.com/" flex="1"/>
</window>

Of course the other files in the directory structure are required as well.

Deploying a finished HTML web app with XULRunner?

I suggest you check out Webapp XUL Wrapper. From the README:

Webapp XUL Wrapper is a collection of build scripts for packaging a webapp into distributable bundles for Mac, Windows, and Linux.

The end result is a standalone and offline version of your web application.

Included in the distribution package:

  • A minimal XUL application with a main browser window and an about dialog
  • A bundled HTTP server
  • XULRunner 17 (Gecko 17)

Build standalone XUL program based on Firefox's `-app` switch

What you want to do is really pretty much the original use case. I've only personally seen it done with NSIS, but also Inno is mentioned in the documentation.

Here are some helpful links...

Deploying XULRunner
Gives a high level overview.

The short version is that you need to bring your own installer solution, but one example is detailed here:
Windows Into setup installer

Or, using NSIS, this stub:
Sample NSIS script for XULRunner

Xulrunner runs but does nothing

Posting this to close this question, since it doesn't need further answering.

The fault was with me - the app required a valid prefs.js file which I hadn't created because I was under the impression it wasn't required unless you intended to have preferences in your app. The MDN (at least at the time) specified this.

How to run code during the firstrun of a Xulrunner Application

Unfortunately the standard way of doing first run code is to use the pref system to determine if you have or haven't done something yet. There are a few gotchas though:

  • Make sure this code only runs once. If your firstrun code is in an overlay or main browser window, it can be run multiple times (once per window)

  • after you run the code and set the pref, make sure you flush the prefs, since prefs are written on close and will only be saved when you close.

    Components.classes['@mozilla.org/preferences-service;1']
    .getService(Components.interfaces.nsIPrefService)
    .savePrefFile(null);

Opening a CSV file from an XULRunner browser tag

It looks like your guess was correct and the issue is related to branding. unknownContentType.xul loads three locale files:

<!DOCTYPE dialog [
<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
%brandDTD;
<!ENTITY % uctDTD SYSTEM "chrome://mozapps/locale/downloads/unknownContentType.dtd" >
%uctDTD;
<!ENTITY % scDTD SYSTEM "chrome://mozapps/locale/downloads/settingsChange.dtd" >
%scDTD;
]>

brand.dtd is the only one that isn't part of XULRunner, it has to be supplied by the application. However, loading it apparently fails and prevents the other DTD files from loading as well (XULRunner complains about the very first entity in the dialog).

Now you don't need to put unknownContentType.dtd into your extension, it is already part of XULRunner. Other than that you've done everything correctly. However, the paths in chrome.manifest should be relative to the manifest, not to the application root. So the path probably should be locale/branding/ rather than chrome/locale/branding/. You should open chrome://branding/locale/brand.dtd in your application to verify that it has been set up correctly.

The other common issue: DTD files have to be saved in UTF-8 format without a byte order mark (BOM). If your editor saves a BOM by default then you need to reconfigure it. XULRunner will consider files starting with a BOM invalid and ignore them.



Related Topics



Leave a reply



Submit