为什么在 Xul 的 XBL 中我无法从 window.opener 调用方法?

发布于 2024-10-07 01:50:00 字数 450 浏览 1 评论 0原文

我有一个 XBL 方法:

        <method name="getValue">
            <body>
                <![CDATA[
                    return "TEST"
                ]]>
            </body>
        </method>

并且在新打开的窗口中,我调用:

print(window.opener.getChannel()); // this prints the value

但它说

window.opener.getChannel 不是 功能

为什么?

I have a XBL method:

        <method name="getValue">
            <body>
                <![CDATA[
                    return "TEST"
                ]]>
            </body>
        </method>

and, in a new opened window, I call:

print(window.opener.getChannel()); // this prints the value

but it says that

window.opener.getChannel is not a
function

why?

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

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

发布评论

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

评论(1

情痴 2024-10-14 01:50:00

对于 window.opener MDN 文档说:

Returns a reference to the window that opened this current window.

除非您的 XBL 扩展了该窗口,否则您将没有该方法,并且我不确定您是否可以通过 XBL 以这种方式扩展窗口。我的意思是 - 如果您扩展 vbox 或类似的东西,您可以执行 getDocumentById 然后调用该对象上的方法,但是您将如何使用 window 来做到这一点?

For window.opener MDN documentation says:

Returns a reference to the window that opened this current window.

Unless your XBL is extending that window you won't have the method, and I'm unsure if you can extend window in that manner by XBL. What I mean by that is - if you were extending vbox or such it's OK, you can do getDocumentById and then call method on that object, but how would you do it with window?

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