BrowserInteropHelper.HostScript 在 Firefox 中的 XBAP 中为 null

发布于 2024-08-29 18:54:21 字数 685 浏览 3 评论 0原文

我们尝试使用完全信任的 XBAP 作为 Javascript 和 COM 之间的一种独立于浏览器的桥梁。 .NET 4 允许通过 BrowserInteropHelper.HostScript 编写 XBAP 脚本,这在 Internet Explorer 中确实工作得非常好。该过程大约是:

  1. 脚本创建一个 iframe 并将 src 设置为类似“../Xbaps/InteropXbap?[xbapInstanceNumber]”。
  2. XBAP 加载后,它会调用 BrowserInteropHelper.HostScript.Xbap.registerImplementation([xbapInstanceNumber], [interop object])。

window.Xbap 只是一个用于处理来自 XBAP 回调的 JS 对象。

在 IE 中,它执行 Javascript 回调,并且脚本可以愉快地调用互操作对象上的方法。

在 Firefox 3.6.3 中,BrowserInteropHelper.HostScript 为 null,因此任何使用它的尝试都会引发运行时绑定异常。

Firefox 的 WPF 插件已安装,并且 XBAP 已加载。 MS 声称 .NET 4 XBAP 脚本功能适用于“所有受支持的 IE 和 Firefox 版本”。

知道这是怎么回事吗?

谢谢!

We're trying to use a full-trust XBAP as a sort-of-browser-independent bridge between Javascript and COM. .NET 4 allows scripting of XBAPs via BrowserInteropHelper.HostScript, and this does indeed work very nicely in Internet Explorer. The process is approximately:

  1. Script creates an iframe and sets the src to something like '../Xbaps/InteropXbap?[xbapInstanceNumber]'.
  2. Once the XBAP has loaded, it calls BrowserInteropHelper.HostScript.Xbap.registerImplementation([xbapInstanceNumber], [interop object]).

window.Xbap is just a JS object for handling callbacks from XBAPs.

In IE, it performs the callback into Javascript and the script can cheerfully call methods on the interop object.

In Firefox 3.6.3, BrowserInteropHelper.HostScript is null, so any attempt to use it throws runtime binding exceptions.

The WPF plugin for Firefox is installed and the XBAP does load. MS claim that the .NET 4 XBAP scripting feature works with 'all supported versions of IE and Firefox'.

Any idea what's going on here?

Thanks!

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

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

发布评论

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

评论(1

旧城烟雨 2024-09-05 18:54:21

确保插件版本 4 在 Firefox 中处于活动状态(关于:插件)。不幸的是,这可能还没有针对 Windows 7 发布。但是您可以从 XP 移植(不受官方支持)。

Make sure version 4 of the plug-in is active in Firefox (about:plugins). Unfortunately, this may still not have been released for Windows 7. But you could transplant the one from XP (not officially supported).

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