为什么在XUL的XBL中我无法从window.opener调用方法?
-
08-10-2019 - |
题
我有XBL方法:
<method name="getValue">
<body>
<![CDATA[
return "TEST"
]]>
</body>
</method>
而且,在一个新的打开窗口中,我打电话给:
print(window.opener.getChannel()); // this prints the value
但是它说
window.opener.getChannel不是功能
为什么?
解决方案
对于窗口。开机MDN文档说:
Returns a reference to the window that opened this current window.
除非您的XBL扩展该窗口,否则您将没有该方法,我不确定您是否可以通过XBL以这种方式扩展窗口。我的意思是 - 如果您扩展了Vbox或这样可以,则可以做getDocumentById,然后在该对象上调用方法,但是您将如何使用窗口进行操作?
不隶属于 StackOverflow