阻止富媒体(Flash)广告更改页面上 CSS 元素的方法?
我在我的网站上使用展示广告,我注意到某些可展开广告(当您将鼠标滑过时展开的广告)通过添加代码“可见性:隐藏”作为内联 CSS 更改了我页面上的一些元素。这会导致文本框和其他内容在广告加载时消失。除了简单地禁用有问题的广告(这不是一个好的解决方案,因为我永远不知道其他广告是否会导致问题),是否有办法阻止广告像这样将 CSS 指令注入我的网站?任何建议表示赞赏!
I use display advertising on my site and I noticed certain expandable ads (ads that expand when you roll over them) changes some of the elements on my page by adding the code "visibility: hidden" as inline CSS. This results in text boxes and other content disappearing when the ad loads. Other than simply disabling the offending ad (not a good solution since I never know what other ads might be causing problems or not), is there a way to block ads from injecting CSS instructions into my site like this? Any advice appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Flash 添加可能正在使用 Flash 中的ExternalInterface 功能将 javascript 通过管道传输到您的页面:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
最简单的方法要确保不会发生这种情况,请将嵌入广告的对象标记上的allowScriptAccess 设置为 false:
http://kb2.adobe.com/cps/164/tn_16494.html
如果您需要需要allowScriptAccess的功能(navigateToUrl来介意)然后事情会变得有点复杂:-)
It's likely the flash add is using the ExternalInterface feature in flash to pipe javascript to your page:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
The easiest way to make sure this doesn't happen is to set allowScriptAccess to false on your object tag where the ad is embedded:
http://kb2.adobe.com/cps/164/tn_16494.html
If you need the functionality that require allowScriptAccess (navigateToUrl comes to mind) then things get a little bit more complicated :-)