Deny iframe javascript to scroll parent window

I have a website with banner ads loaded with iframes. Banner ads always scroll through the parent window when the banner does not fit into the visible area. This is really annoying, and I would like to prevent javascript iframes from scrolling through the main window.

Here is what I have already tried:

  • Move the iframe src code to another domain. Normally js from another domain should not have access to the parent window, right ?! This does not work.

  • Overwrite window.moveTo, window.scrollTo, window.scrollBy in the video with my own functions. This does not seem to work, since none of these functions appear to be called. :-(

Any help would be really great :-)

+4
source share
1 answer

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

0
source

Source: https://habr.com/ru/post/1305002/


All Articles