A way to block rich media (flash) ads from changing CSS elements on a page?
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: hi开发者_开发问答dden" 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!
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 :-)
精彩评论