changing the content of browser in XULRunner
Asked Answered
B

1

1

I have an Xulrunner app that loads fullscreen without any controls and loads a html page by default. The only thing it has is browser element and a popup menu visible on right click. In the popup menu there is option to quit. Then there is a menu entry 'theme2'. I want the browser to load another html when theme2 is clicked.

This is my main.xul, thats loaded by default:

<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="Edusoft" hidechrome="true" sizemode="maximized" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/x-javascript">
function do()
{
 var browser1 = document.getElementById('browser');
 browser1.loadURI("chrome://myapp/content/theme2/home.html");
}
</script>

<browser id="browser" type="content" src="chrome://myapp/content/theme1/index.html" flex="1" context="clipmenu"/>



<popupset>
  <menupopup id="clipmenu">
       <menuitem label="About Us"/>
    <menuseparator/>
    <menuitem label="Theme2" oncommand="do();"/>
    <menuseparator/>
    <menuitem label="Exit" oncommand="close();"/>
  </menupopup>
</popupset>

</window>

I tried this, but when the page is loaded this way.. the popup menu is nomore in the new page.

window.location.assign()

There is something like loaduri(), but i have no idea on how to use it.

Buchner answered 1/8, 2010 at 10:28 Comment(0)
B
1

Ok I figured it out.

document.getElementById('browser').loadURI('chrome://myapp/content/flash/demo.htm')
Buchner answered 1/8, 2010 at 14:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.