There is such a well-known Form plugin for jQuery. I consider it one of the best for asynchronous form submission.
But at one time I had to abandon its use due to the inoperability when sending files asynchronously to Opera 10. Everything was fine with my ninth Opera.
The problem is unusual: files of a certain size (I have up to 80-90kb) load normally. But if the file is larger, none of the callback functions (
success ,
error ) work. At the same time, the file is correctly uploaded to the server, but this moment can no longer be caught from the browser. There is no such problem in IE, FireFox and Chrome.
On February 19th, the latest version of the plugin was released, where
some problem with Opera iframe was fixed , but it did not help.
')
I never found a solution on the Internet and dug it myself. Everything turned out to be simple.
We
look for the word "opera" in the
jquery.form.js file and get here:
var domCheckCount = 50 ;
.....
if (--domCheckCount) {
// in some browsers ( Opera ) the iframe DOM is not always traversable when
// the onload callback fires, so we loop a bit to accommodate
cbInvoked = 0;
setTimeout(cb, 100);
return;
}
log('Could not access iframe DOM after 50 tries.');
return;
Opera does not have time to access the iframe at once, and tries to do it in a loop. 50 times obviously not enough. We change it to a bigger number and
have no problems (in fact, it all depends on the file size).
But another is interesting. The problem is not fixed until the latest version of the plugin.
And if it manifests itself only with a certain size of the downloaded file, I can assume that, one way or another, there is a performance issue, which is why the respected author of the plugin Mr.
malsup could skip it,
his computer is just more powerful .
PS You can just redo the loop to an infinite one, really I don’t know if there will be consequences of this action. I set
domCheckCount = 200 and wrote to the plugin author about it.
UPD: The author of the plugin at my request
corrected this problemUPD: A
new version of the plugin has been released.UPD: To date, the problem has been passively resolved by the author passively (the values of the
domCheckCount = 100 variable
are sometimes not enough), for this reason I transfer to the jQuery blog.
Source of articles can be found here.