This is the situation: I have on the same domain, an iframe inside my web site. currently, I have no immediate access to the iframe code as of deployment issues.
when the iframe loads, the code inside it detects something that triggers a redirection on the parent page. Temporarily, I want to remove it. I know I can use the onbeforeload, but a warning will be displayed every time the user click on a any link.
Is there a way I can detect the redirection? it happens before the main parent page is fully loaded.
I googled it a lot but still have no working solution.
Thanks!
Use sandbox attribute. <iframe src=”Site_URL” sandbox=””> – Full Protection.
Some site owners use iFrames to display other Web pages; others add videos or other objects in iFrames and position them around their pages. Using a simple HTML trick, you can use an iFrames to redirect users to other Web pages without changing the URL that appears in their browsers.
Overview. The widget is considered deprecated. If you need to use an IFrame, consider the "IFrame Component" widget The Iframe can be used to embed websites in the client.
After reading the w3.org spec. I found another solution.
You can set sandbox=""
, which prevents the iframe frome redirecting. That being said it won't redirect the iframe either. You will lose the click essentially.
Example here: http://jsfiddle.net/ppkzS/1/
Example without sandbox: http://jsfiddle.net/ppkzS/
Try this:
<iframe align="left" src="http://stackoverflow.com/" sandbox=""></iframe>'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With