简体   繁体   中英

Determining when contents of an IFrame has loaded

NB: I don't believe this is a duplicate of Detect failure to load contents of an iframe or Detecting when Iframe content has loaded (Cross browser) (or any of the similar ones).

In short I'm using an IFrame to display Pdfs using the browsers' internal viewer. Since we only support Chrome/FF (we use WebGL) and both have an embedded Pdf viewer, it's a convenient way to avoid implementing pdf.js (at least until we need more control / can spare the resource).

That said, we do want to be able to detect when the IFrame has finished loading so we can transition properly/detect problems.

So, assuming the IFrame source is a pdf (and the pdf is coming from the same domain), is there any way to determine when the iframe has loaded from the outside ?

使用iframe.Simple的onload事件

<iframe src="test.pdf" onload="alert('Worked')" ></iframe>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM