Skip to content
Advertisement

Are there anyway to prevent frame override main window?

I have html page with frame where I want to show some web pages/sites. There are some sites like www.yandex.com which popup from frame and become main window. I want to find some solution to intercept some event or something like this to prevent such subframe activity. Is it possible?

Advertisement

Answer

You can listen to the onbeforeunload event, which fires before navigation away from the page. You can potentially stop an unwanted redirection.

Howvever you can’t do much due to the Same origin policy.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement