Redirect to page while removing iframe

-1

When the iframe is edited or removed the page is automatically redirected to my url ...

<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"></script><scripttype="text/javascript">
//<![CDATA[
$(document).ready(function()
{
 if($("#bloqueio").attr("src")!="http://www.google.com/?=urldoiframe")
 {
   window.location.href="http://www.google.com/?=destino";
 }
});
//]]>
</script>

<style> #bloqueio {height:30px;} #bloqueio iframe{width:100%;height:32px;position:fixed;top:0px;left:0px;z-index:1;overflow-x:hidden;} </style>

<div id='bloqueio'><iframe src='URLDOIFRAME' border='0' frameborder='0' marginheight='0' marginwidth='0' name='topo' noresize='noresize' scrolling='auto'></iframe></div>

how to proceed? already tried iframe.attr and nd to lost

    
asked by anonymous 15.09.2018 / 07:02

1 answer

0

Notice the onload event of iframe :

<iframe src='URLDOIFRAME' onLoad="this.contentWindow.location = 'http://www.google.com/?=destino' ... >

Or use jquery :

$('#id-do-iframe').on('load', function(obj) {
    obj.contentWindow.location="http://www.google.com/?=destino";
});
    
15.09.2018 / 18:39