开发者

deny iframe javascript to scroll parent window

开发者 https://www.devze.com 2022-12-24 17:27 出处:网络
I\'ve a site with banner ads, loaded using iframes. The banner ads always scroll the parent window when the banner doesn\'t complety fit into the visible region. This is really annoying and I\'d like

I've a site with banner ads, loaded using iframes. The banner ads always scroll the parent window when the banner doesn't complety fit into the visible region. This is really annoying and I'd like to deny the javascript of the iframes to scroll the main window.

Here is what I already tried:

  1. Move the iframe src code to another domain. Normally js from another domain should not be allowed to access the parent window, is it?! This doesn't work.

  2. Overwrite window.moveTo, window.scrollTo, window.scrollBy in parent with my own functions. This doesn't seem to work neither, as none of these functions seems to be ca开发者_JAVA百科lled. :-(

Any help would be really great :-)


Give the iframe a width and set a style for it like overflow: hidden;?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号