Detect when an iframe is loaded

后端 未结 13 1365
梦如初夏
梦如初夏 2020-12-03 21:11

I\'m using an

That's a bad practice, I know, but sometimes job need to be done fast, eh?

UPDATE Well, I'm afraid you have to spend a long and painful day with a JS debugger. load event should work. I still have some suggestions, though:

1) Try to set event listener before setting element's src. Maybe onload event fires so fast that it slips between creating element and setting event's callback

2) At the same time try to check if your server code plays nicely with iframes. I have made a simple test which attempts to download a PDF from Dropbox, try to replace my URL with your backed route's.






UPDATE 2

3) Also, look at the Network tab of your browser's debugger, what happens when you set src to the iframe, it should show request and server's response with headers.

提交回复
热议问题