xulrunner弹出窗口不显示解决方法

来源:互联网 发布:node forever 启动 编辑:程序博客网 时间:2024/06/05 03:07
如果网页中有弹出窗口需要显示,不知道为什么默认xulrunner是不能显示弹出窗口的,但是同一版本的firefox -app却可以显示,通过搜索找到了解决方案。

Error Consol显示的信息如下:
错误信息:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://blog.oifile.com/:: open_popup :: line 155" data: no]
同时还有一个消息(message):
No chrome package registered for chrome://navigator/content/navigator.xul

你可以在这里找到原来的讨论:
http://groups.google.com/group/mozilla.dev.platform/browse_thread/thread/5ba466727c590004

pref("browser.chromeURL", "chrome://path/to/window.xul"); 
上面的方式我在xulrunner 1.9.1没有成功。

我的解决方案如下:
首先创建一个window.xul窗体
内容如下:
<?xml version="1.0"?>
<!DOCTYPE window PUBLIC "-//MOZILLA//DTD XUL V1.0//EN" "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

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

<window id="popup_window"
        title="popup"
        xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns:rdf="http://www.w3.org/1999t/02/22-rdf-syntax-ns#"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        width="800"
        height="600"
        screenX="20"
        screenY="20"
        >
<browser type="content-primary" flex="1" style="background-color:blue"></browser>
</window>

然后在chrome.manifest中添加下面一行代码:
override chrome://navigator/content/navigator.xul   chrome://app/content/window.xul

就是把提示的窗体用自己的窗体替换到,这样就可以了。


Thanks: http://hi.baidu.com/qtnmjcqmfldhmwr/item/aff35c3472c872bc134b149c

原创粉丝点击