Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple XULRunner app to load a web page

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?

like image 763
Chimera Avatar asked Feb 03 '13 15:02

Chimera


2 Answers

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.

like image 133
Chimera Avatar answered Nov 11 '22 15:11

Chimera


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>
like image 30
Rembunator Avatar answered Nov 11 '22 13:11

Rembunator