Monday, May 20, 2024
83
rated 0 times [  84] [ 1]  / answers: 1 / hits: 30804  / 13 Years ago, wed, may 25, 2011, 12:00:00

I am having a problem with onLoad event of an iframe on Google Chrome. I created an iframe and set value for its src attribute to get a file from server. While server is processing, a waiting box is displayed until client gets the returned file. I tried to use the onLoad event of iframe to detect when client get the file to turn off that waiting box, but on Google Chrome that event handler does not work.

With Firefox, when client gets a file, a Save to popup will be displayed automatically and event load will be fired, but this is not happen on Chrome.

Could you please tell me how to handle this issue? Thank you so much!


More From » google-chrome

 Answers
39

I've run into this exact issue. It turns out Chrome triggers absolutely no events in an iframe upon a file download.



Since there are no events to look out for and you're returning a file (as apposed to any inline content) the workaround I was forced to inspect the contents of the iframe after a few seconds, if it is empty then assume there were no errors and the results were processed correctly. If it contains data (my server will return JSON if there are any errors) then handle the error data accordingly.


[#92054] Tuesday, May 24, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trayvon

Total Points: 35
Total Questions: 117
Total Answers: 88

Location: Guernsey
Member since Tue, Jul 6, 2021
3 Years ago
;