简体   繁体   English

难题:不同的域iframe需要动态地“重叠”父内容

[英]Puzzle: different domain iframe needs to dynamically “overlap” parent content

This should be a fun puzzle for you Stack Overflow geniuses: 对于您的Stack Overflow天才来说,这应该是一个有趣的难题:

I'm building a browser plugin that will inject a div , script , and iframe into the markup of whatever page the client is viewing. 我正在构建一个浏览器插件,该插件会将divscriptiframe注入客户端正在查看的任何页面的标记中。 The purpose is to anchor a toolbar onto the bottom of every page ( StumbleUpon does this for Chrome). 目的是将工具栏固定在每个页面的底部( StumbleUpon针对Chrome进行此操作)。 Here's the code that is placed before </body> : 这是放在</body>前面的代码:

<div id="someID1" style="position: fixed; bottom: 0px; left: 0px; width: 100%; height: 100%; background-color: transparent;">
    <iframe id="someID2" src="http://www.example.com/iframeContent.html" frameBorder="0" scrolling="no" style="background-color: transparent; margin: 0px; height: 100%; width: 100%; padding: 0px;"/>
</div>

This toolbar ( iframe ) will be hosted on our server and has pop-out panels. 该工具栏( iframe )将托管在我们的服务器上,并具有弹出面板。 When a user clicks to open a menu, the menu vertically extends the toolbar (eg, toolbar height is 35px; with panel is 100px). 当用户单击以打开菜单时,菜单会垂直扩展工具栏(例如,工具栏高度为35px;面板为100px)。

I can accomplish this in Safari, Firefox, and Chrome by having my toolbar sit on top of everything on a transparent background (ie, height: 100% and background-color: transparent for both the div and iframe ). 我可以在Safari,Firefox和Chrome浏览器中实现此目的,方法是使工具栏位于透明背景上的所有内容之上(即, diviframe height: 100%background-color: transparent )。 But this doesn't work for IE7, IE8, IE9. 但这不适用于IE7,IE8,IE9。

I've tried (1) doing background: blank.gif instead of background-color: transparent, and (2) injecting a script into the parent with a resizing function that I could call on with parent.resizeFunction(height) ("resource denied") 我试过(1)做background: blank.gif而不是背景颜色:透明,和(2)注入script与调整大小功能父,我可以打电话与parent.resizeFunction(height) (“资源拒绝”)

Any ideas on how to solve this?? 关于如何解决这个问题的任何想法? Thanks so much! 非常感谢!

I have to run so I can't test it, but IE seems to listen to the non-standard ALLOWTRANSPARENCY property. 我必须运行,所以我无法对其进行测试,但是IE似乎正在侦听非标准的ALLOWTRANSPARENCY属性。

When the property is set to false, the backgroundColor property of the object can only be that of the window. 当该属性设置为false时,对象的backgroundColor属性只能是窗口的backgroundColor属性。 When the property is set to true, the backgroundColor property of the object can be set to any value, including the default value of transparent. 当该属性设置为true时,可以将对象的backgroundColor属性设置为任何值,包括透明值的默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM