I have a forms control on my html page, with a target set to the name of another hidden iframe on the page.
When I do a form.submit via a post call, I wish to show a busy/progress indicator until I receive a response from the post request within the iframe.
I tried using document.getElementById(“iframename”).readyState in IE and it works like a treat, but how do I handle such a scenario in Chrome/Firefox/Safari etc…?
My understanding is that the readyState is not available in other browsers for the html elements including the iframe, except for IE.
Any suggestions would be greatly appreciated.
Thanks.
I found the answer at
http://geekswithblogs.net/GruffCode/archive/2010/10/28/detecting-the-file-download-dialog-in-the-browser.aspx
Instead of using browser dependant onreadystate,
1) We randomly generate a key to be submitted with the form.
2) In javascript, show progress indicator, run a timer that checks for match of cookie and key, if match, clear timer and hide progress, before submitting.
3) We read the key on the server, append the key to the cookie response.
4) On response, if cookie match, progress indicator will hide.
Ingenious!