Redirect to page when removing iframe

Asked

Viewed 20 times

-1

When 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>

<script type="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 e nd to perdido

1 answer

0


Note the "onload" event from iframe:

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

Or use the jquery:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.