屏蔽插件(或小程序)以在 Mac 上的 Chrome 中显示 html 内容
对于我在 Windows 和 MacOSX 中尝试过的所有其他浏览器(包括 Windows 下的 Chrome),使用“iframe shim”效果很好。但是,我无法让 iframe 垫片在 Mac 上的 Chrome 中使用我们的插件。
在谷歌上搜索了这个问题并做了一些测试后,它似乎取决于对象。我发现一个使用 StreetView(Flash 对象)的示例可以工作,另一个使用 Java Applet 的示例则不起作用。
一些链接:
这是该方法的描述:http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/
这个使用 Java Applet 的示例来自上述文章: http://www.oratransplant.nl/files/ iframe_shim.html
这是使用街景的工作版本:http://gmaps-samples.googlecode.com/svn/trunk/streetview/iframeshim.html
通过在 Chrome 中检查(和编辑)元素并在两个示例页面之间复制对象,看来 flash 对象只允许 iframe 垫片(在 Mac 上的 Chrome 中),但 Java Applet 不允许。
在我们的例子中,我们使用的是用 Firebreath 构建的自定义插件。
我可能需要在我们的插件中实现额外的功能,模仿 flash 所做的任何事情,但这很可能是由 Chrome 的 Mac 版本中的错误引起的。
有人可以帮忙吗?我们确实希望能够通过我们的插件显示 HTML 元素,并且 iframe shim 几乎适用于所有浏览器/操作系统组合!
For all other browsers that I've tried in both Windows and MacOSX (including Chrome under Windows) using an "iframe shim" works fine. However, I have not been able to get iframe shims to work over our plugin in Chrome on the Mac.
Having Googled the problem, and done some testing, it appears to depend upon the object. I've found an example using StreetView (a flash object) which works, and another example using a Java Applet which does not work.
Some links:
Here's a description of the method: http://www.oratransplant.nl/2007/10/26/using-iframe-shim-to-partly-cover-a-java-applet/
This example using a Java Applet is from the above article: http://www.oratransplant.nl/files/iframe_shim.html
And here's the working version using Streetview: http://gmaps-samples.googlecode.com/svn/trunk/streetview/iframeshim.html
By inspecting (and editing) elements in Chrome and copying the objects between the two example pages, it appears to be that the flash object just allows iframe shims (in Chrome on the Mac), but that the Java Applet does not.
In our case we are using a custom plugin, built with Firebreath.
It may be that I need to implement extra functionality into our plugin, mimicking whatever flash is doing, but this could well be caused by a bug in the Mac build of Chrome.
Can anyone help? We really do want to be able to show HTML elements over our plugin, and the iframe shim works on almost all browser/OS combinations!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
缺乏合成是 Mac Chrome 中使用核心动画或无效核心动画的任何插件的一个已知错误。这个问题将在未来的版本中得到解决——理论上,你永远不需要在 Mac 上使用 iframe hack,并且插件应该始终正确组合。如果您感兴趣,您可以使用 NPN_GetValue 和值 74656 来检测插件中是否动态支持核心动画的合成(请参阅 WebKit 源代码中的 WKNVSupportsCompositingCoreAnimationPluginsBool ;这应该很快就会添加到正式的 NPAPI 规范中,但该值不会更改,因此您现在可以对其进行硬编码,当 Chrome 支持它时,它将开始返回 true)。
一般来说,iframe hack 应该可以在最新版本的 Chrome 中运行(您正在测试什么版本?),但是有一些错误,直到页面重新布局后才会被注意到,因此您可能需要强制使用那。
请注意,您的街景示例不是 Mac Chrome 上的有效测试,因为它使用 wmode=opaque,这意味着它使用 CG 模式,而不是 CA 模式,因此无论 iframe 黑客如何,合成都可以完全正常工作。
The lack of compositing is a known bug in Mac Chrome with any plugin using Core Animation or Invalidating Core Animation. It will be resolved in some future version--in theory, you should never need an iframe hack on the Mac, and plugins should always composite correctly. If you are interested, you can detect whether compositing of Core Animation is supported dynamically in your plugin using NPN_GetValue with the value 74656 (see WKNVSupportsCompositingCoreAnimationPluginsBool in the WebKit source; this should be added to the formal NPAPI spec soon, but the value won't change, so you can hard-code it now and when Chrome supports it that will start returning true).
In general the iframe hack should work in recent versions of Chrome (what version are you testing?), but there are some bugs where it doesn't get noticed until the page gets a re-layout, so you might want to play with forcing that.
Note that your Streetview example isn't a valid test on Mac Chrome, because it's using wmode=opaque, which means it's using the CG mode, not CA mode, and thus compositing works completely regardless of the iframe hack.
您使用什么绘图方法?你不需要在Mac上使用iframe而不是插件,因为所有绘图都是无窗口的,除非你正在做一些奇怪的事情,我不希望Chrome能够做到这一点(即在coregraphics或quickdraw上下文上创建opengl上下文)。如果你做这样的事情,你可能就无能为力了。
一种简单的设置是将插件大小调整为 1x1 以有效“隐藏”它。
What drawing method are you using? You shouldn't need to use an iframe over a plugin on Mac because all drawing is windowless, unless you're doing strange things that I wouldn't expect to be possible with Chrome (i.e. creating an opengl context over a coregraphics or quickdraw context). If you were doing something like that there would probably not be anything you could do.
One easy setting would be to just resize the plugin to 1x1 to effectively "hide" it.