【问题标题】:Define XULRUNNER default window url定义 XULRUNNER 默认窗口 url
【发布时间】:2015-02-13 00:34:49
【问题描述】:

我需要做一个简单的任务,但它看起来对我来说很繁重,我需要创建 XULRUNNER 系统,它在默认窗口中打开 WWW.test.com,没有地址栏或任何菜单,仅此而已,这是我的代码,但是它似乎不起作用,有人可以帮忙吗?

main.js

function url() {
  windowObjectReference = window.open("http://www.test.com/", "test_WindowName", strWindowFeatures);
}

main.xul

<?xml version="1.0"?>

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

<window id="main" title="My App" width="500" height="500" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/javascript" src="chrome://myapp/content/main.js"/>
</window>

pref.js

pref("toolkit.defaultChromeURI", "chrome://myapp/content/main.xul");
pref("toolkit.defaultChromeFeatures", "chrome,dialog=no,all");
 pref("toolkit.singletonWindowType", "xulmine");

/* debugging prefs, disable these before you deploy your application! */
pref("browser.dom.window.dump.enabled", true);
pref("javascript.options.showInConsole", true);
pref("javascript.options.strict", true);
pref("nglayout.debug.disable_xul_cache", true);
pref("nglayout.debug.disable_xul_fastload", true);

【问题讨论】:

    标签: url window.open xulrunner


    【解决方案1】:

    只需使用&lt;browser&gt; 元素

    <?xml version="1.0"?>
    
    <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
    
    <window id="main" title="My App" width="500" height="500" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
    
        <script type="application/javascript" src="chrome://myapp/content/main.js"/>
    
        <vbox id="browerbox" flex="1">
            <browser flex="1" id="testbrowser" src="http://www.test.com/ />
        </vbox>
    
    </window>
    

    浏览器是非常强大的元素,我会阅读所有您可以使用的AttributesPropertiesMethodshttps://developer.mozilla.org/en-US/docs/Mozilla/Tech/XUL/browser。我在上面给您的内容将起作用,但取决于您最终需要做什么,您可能需要进行一些更改。

    【讨论】:

    • 感谢它就像一个魅力,但我还有另一个问题,当我点击一个应该在新窗口中打开的链接时,XULRunner 在它仍在运行时消失了,我可以在任务管理器中看到它。
    • 不幸的是,我在学习如何处理链接方面还没有走得那么远。在四处挖掘时,我看到了一些信息,但还不需要使用它。
    猜你喜欢
    • 2020-02-16
    • 2011-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-17
    • 2012-04-05
    • 1970-01-01
    相关资源
    最近更新 更多