更改 XULRunner 中浏览器的内容

发布于 2024-09-12 07:25:35 字数 1226 浏览 3 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏至、离别 2024-09-19 07:25:35

好吧,我想通了。

document.getElementById('browser').loadURI('chrome://myapp/content/flash/demo.htm')

Ok I figured it out.

document.getElementById('browser').loadURI('chrome://myapp/content/flash/demo.htm')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文