Question

I have not ever used XUL and it seems quite mysterious. What does it take to create a simple XUL application that simply loads a webpage on a Linux environment?. No need for window decorations, history, back or forward buttons. Just the simplest possible XUL app that loads a web page... Using xulrunner with GRE version 10.0.11.

Also, where is the best place to get tutorials to learn about writing XUL application?

Was it helpful?

Solution

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.

OTHER TIPS

Maybe this will do the trick, loading the page from the commandline argument:

Start with:

xulrunner /path/to/application.ini -test "http://www.google.nl"

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>

<script type="application/x-javascript"> <![CDATA[
    function init_browser()
        {
        var cmdLine = window.arguments[0];
        cmdLine = cmdLine.QueryInterface(Components.interfaces.nsICommandLine);
        document.getElementById('id_browser').src = cmdLine.handleFlagWithParam("test", false));
        }
]]></script>

 <window id="main" title="Konami Browser" width="800" height="600" 
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    onload="init_browser();">
        <browser id='id_browser' type="content" src="http://google.com/" flex="1"/>
</window>

]]></script>

Now that you already provided the correct answer you may want to look at a simple XUL Tutorial to answer possible further questions:

http://www.xul.fr/tutorial/

I dont have XULRunner and hence cant write XUL code, but I found a post here, which gives hint on how to access command line arguments.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top