[[!meta title="XULRunner rocks!"]] [[!meta date="2011-03-15 22:16"]] [[!meta author="rohieb"]] [[!meta license="CC-BY-SA 3.0"]] For [[one of my projects|projects/infopoint-html]], I needed an application to display a web page in full screen mode. At first, I used Firefox with the [AutoHide extension][0], but this solution was more of a hack and not easy to deploy to multiple machines — I worked with a pre-configured user profile that was copied every time the application started. Furthermore, after each update, Firefox would check for compatibility of installed plugins and displayed a nasty dialog in the meantime. So I tried to move away from Firefox and do something on my own, something slim which did just what I wanted, nothing more, and do it good — according to the [UNIX philosophy][1]. But writing another C/C++/Python/whatever application from scratch was not an option (implementing an HTML renderer would be a pain, and I didn’t fancy reading extensive manuals about WebKit, Gecko or any other rendering engine). After a while of thinking, which included thought fragments of [Songbird][2] and [Conkeror][3], I decided to give [XULrunner][4] a shot (for those who do not know, XUL is the XML-based user interface language used by the Mozilla applications and the Firefox and Thunderbird extensions, and XULRunner is an interpreter and run-time environment for XUL documents). So after a while of hacking (there is a good [tutorial on the Mozilla Developer Network][5]), I ended up with a few lines of code: [[!format xml """ <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="main.css" type="text/css"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" id="viewer" windowtype="viewer" title="Infopoint HTML View" hidechrome="true"> <hbox flex="1"> <iframe id="contentview" flex="1" src="chrome://infopointhtmlviewer/content/default.html" /> </hbox> <script> // load URI given on command line var content = document.getElementById("contentview"); var cmdLine = window.arguments[0].QueryInterface( Components.interfaces.nsICommandLine); var uri = content.getAttribute("src"); alert("Default URL: " + uri); if(cmdLine.length > 0) { uri = cmdLine.getArgument(0); } if(content != null) { content.setAttribute("src", uri); } // resize to full screen window.resizeTo(screen.width, screen.height); </script> </window> """]] The above code is in the public domain. And that was basically everything. I was surprised that there was nothing more to it. You can get the source code of the full application [on GitHub][6]. [0]: http://web.archive.org/web/20120415204503/http://www.krickelkrackel.de/autohide/autohide.htm [1]: http://en.wikipedia.org/wiki/Unix_philosophy [2]: http://getsongbird.com/ [3]: http://conkeror.org/ [4]: https://developer.mozilla.org/en/XULRunner [5]: https://developer.mozilla.org/en/Getting_started_with_XULRunner [6]: https://github.com/rohieb/infopoint-html [[!tag programming GitHub JavaScript Mozilla Mozilla_Firefox XUL XULRunner]]