更改 XULRunner 中浏览器的内容
我有一个 Xulrunner 应用程序,它可以在没有任何控件的情况下全屏加载,并默认加载 html 页面。它唯一拥有的是浏览器元素和右键单击时可见的弹出菜单。 在弹出菜单中有退出选项。然后有一个菜单项“theme2”。我希望浏览器在单击 theme2 时加载另一个 html。
这是我的 main.xul,默认加载:
<?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>
我尝试过这个,但是当页面以这种方式加载时..新页面中不再有弹出菜单。
window.location.assign()
有类似 loaduri()
的东西,但我不知道如何使用它。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我想通了。
Ok I figured it out.