[英]Load event not firing in iframe while loading pdf in iframe
這是我的HTML:-
<iframe src="Dyanamicallygeneratedpath" id="iPrintform" name="iPrintform" class="iframeDisable" scrolling="auto" height="600" width="650" style="display:block;"></iframe>
jQuery的:-
第一次嘗試:-
var iFrame = $('#iPrintform');
iFrame.bind('load', function () { //binds the event
alert('iFrame Reloaded');
});
第二次嘗試:-
$("#iPrintform").on("load", function () {
alert("Iframe loaded");
});
我嘗試將加載事件,onready事件綁定到iframe,但Chrome無法正常工作。
嘗試實現以下代碼。
var iframeID = $('#iPrintform').contents();
iframeID.find("addevents").click(function(){
alert("working");
});
等待加載iframe,然后通過iframe的contentWindow.document進行綁定
var xiframe = $('iframe')[0];
iframe.onload = function(){
// log("iframe loaded");
$(xiframe.contentWindow.document)
.bind(function(){ ... });
$(xiframe.contentWindow.body).addClass('..');
};
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.