0
sandip posted
call function of parent webpage from IFRAME
I have page where IFRAME opening as modal box .so i want to call parent web page function from the IFRAME
html code ::
<iframe width="100%" class="embed-responsive-item" frameborder="0"></iframe>
<a style="float:right"
type="button"
class="modalButton "
data-toggle="modal"
data-src=""
data-width="600"
data-height="450"
data-target="#myModal"
>Modalbox
</a>
js code::
//boostrap modalbox for iframe
( function($) {
function iframeModalOpen(){
$('.modalButton').on('click', function(e) {
var src = $(this).attr('data-src');
var width = $(this).attr('data-width') || 640;
var height = $(this).attr('data-height') || 360;
var allowfullscreen = $(this).attr('data-video-fullscreen');
$("#myModal iframe").attr({
'src': src,
'height': height,
'width': width,
'allowfullscreen':''
});
});
$('#myModal').on('hidden.bs.modal', function(){
$(this).find('iframe').html("");
$(this).find('iframe').attr("src", "");
// window.location=document.href;
});
}
$(document).ready(function(){
iframeModalOpen();
});
} ) ( jQuery );
function modalclose(){
$('#myModal').modal('hide');
}
in above scenario . after opening iframe i want to close modalbox when i click on the cancel button in IFRAME page.
in short i want to call mocalclose(Parent webpage function) from the Iframe javascript