在 XUL 中打开一个窗口

发布于 2024-09-18 12:52:05 字数 445 浏览 1 评论 0原文

尝试在 XUL 中使用 window.open 打开窗口时抛出异常。异常详细信息: Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location:

引发异常的代码行是:

newWind = window.open(settings.url, "Dialog", "chrome = yes, width=" + 
          settings.width + ",height=" + settings.height + 
          ",resizable = yes,scrollbars=yes");

谁能告诉我如何解决这个问题。

An exception is being thrown when trying to open a window using window.open in XUL. The exception details: Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMJSWindow.open]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location:

The line of code throwing the exception is:

newWind = window.open(settings.url, "Dialog", "chrome = yes, width=" + 
          settings.width + ",height=" + settings.height + 
          ",resizable = yes,scrollbars=yes");

Can anyone please tell me how to get round this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

ま柒月 2024-09-25 12:52:05

如果其他人也有同样的问题,这里是答案:
http://forums.mozillazine.org/viewtopic.php?t=421261

如果 prefs.js 中有这样一行:
pref("toolkit.defaultChromeURI", "chrome://myapp/content/myapp.xul");

你必须添加另一行,如下所示:
pref("browser.chromeURL", "chrome://myapp/content/myapp.xul");

In case someone else has the same problem here is the answer:
http://forums.mozillazine.org/viewtopic.php?t=421261

If you have a line in prefs.js like this:
pref("toolkit.defaultChromeURI", "chrome://myapp/content/myapp.xul");

you have to add another one line like this:
pref("browser.chromeURL", "chrome://myapp/content/myapp.xul");

掀纱窥君容 2024-09-25 12:52:05

我有一个 XULRunner 应用程序。我的窗口打开行如下:

var win = window.open("关于:空白",window_name,"状态=是,滚动条=是,最小化=是,顶部= 5000,左= 1000,宽度= 1000,高度= 625,可调整大小=是,dialog=no,titlebar=yes");

注意到其中没有空格吗?尝试按照我的方式格式化它,它应该可以工作。

另一个提示:

将该窗口转换为 Chrome,通过:

var chromewin = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation).QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.接口.nsIDOMWindow);

I have an XULRunner app. my window open line is as follows:

var win = window.open("about:blank", window_name, "status=yes,scrollbars=yes,minimizable=yes,top=5000,left=1000,width=1000,height=625,resizable=yes,dialog=no,titlebar=yes");

Notice how there are no spaces? Try formatting it exactly like mine is and it SHOULD work.

Another tip:

Convert that window to chrome, via:

var chromewin = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebNavigation).QueryInterface(Components.interfaces.nsIDocShellTreeItem).rootTreeItem.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindow);

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文