簡體   English   中英

在iframe中加載pdf時,在iframe中未觸發加載事件

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM