Packaging WebRunner Applications
Probably the most frequent question I’ve been getting about WebRunner is how to package up web apps for distribution to end users. Many creators of Prism apps have been distributing them by creating an installer that places the Prism runtime (basically the entire Prism directory) and web app configuration files on the end user’s machine. The good news is that the procedure for installing WebRunner apps is similar. The main difference is that the runtime is now Firefox instead of Prism. Follow the procedure described below to package up the web app files and runtime. Note that this is not “for dummies” and I’m assuming that you are a smart, good-looking and personable developer who knows their way around the Firefox files on their hard disk.
Windows and Linux
Create a staging directory for your app, and copy in the WebRunner stub (“webrunner.exe” on Windows and “webrunner” on Linux) and “application.ini” file (you can find them in the “stub” subdirectory of the WebRunner extension in your Firefox profile directory). Edit “application.ini” to remove the GRE_HOME entry. Create a subdirectory under the staging directory called “xulrunner” and copy in the entire contents of your Firefox directory. On the target machine, you’ll need to install the staging directory somewhere (e.g. “C:Program FilesWebRunner AppsMyApp”) and also copy over the web app home directory (generally under “%APPDATA%/WebApps” on Windows and “~/.webapps” on Linux), perhaps into a subdirectory called “webapp” of the directory where you put the stub.
You’ll need to create a shortcut that runs the stub with a -webapp parameter, followed by the full path to the web app home directory (e.g. “C:Program FilesWebRunner AppsMyAppwebapp”). Now we’re almost done, but skip down to the section called “All platforms” for the final step.
Thinking different? Good, because on Mac the installation procedure is quite different as well. In the app bundle created by WebRunner for your app (e.g. “MyApp.app”), create a new subdirectory under “Contents” called “Frameworks”. Inside that, create another subdirectory called “XUL.Framework”. Copy the entire contents of “Firefox.app/Contents/MacOS” into it. Now edit “MyApp.app/Contents/Resources/application.ini” and remove the GRE_HOME line. See, Mac really is easier! But keep reading since you need to install the WebRunner extension as well.
So far, we’ve basically done the same thing as we would have when packing up Prism apps. There is one big difference, however: Prism had all its special single-site browser magic baked in, whereas what we just set up is just plain vanilla Firefox and some web app config files that Firefox knows nothing about. For this to work, the WebRunner extension has to be installed. The easiest way to do this is to copy the extension directory (generally “email@example.com” in the “extensions” subdirectory of your Firefox profile directory) into the “extensions” directory of the Firefox runtime (i.e. under “xulrunner” on Windows and Linux, under “Contents/Frameworks/XUL.Framework” on Mac). Now open up your “application.ini” again and remove the XRE_PROFILE_PATH line. Also change the Name value in the [App] section to the name of your app, and add a Vendor value under it if you want one (this will determine where the user’s profile directory is created).
Now you just have to create an install program to copy the whole staging directory (or Mac app bundle) onto the end user’s disk. Inno Setup is a good way to do this on Windows. On Mac, a DMG file is generally used. On Linux, you can just distribute a tar file since everyone who uses Linux is super technical and debugs device drivers in their spare time.
The good news
I’m currently working on a packager for WebRunner that will do all of the above automatically, so consider these instructions a stopgap measure until it is finished.
« WebRunner Available for Download - WebRunner for Firefox 3.6? »