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");

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

4

2 回答 2

2

如果其他人有同样的问题,这里的答案是: 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");

于 2013-09-28T19:41:34.970 回答
0

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

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=不,标题栏=是");

注意没有空格?尝试像我的一样格式化它,它应该可以工作。

另一个提示:

通过以下方式将该窗口转换为 chrome:

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

于 2010-11-16T03:02:48.527 回答