Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix file upload issues with Opera #3

Closed
mpokrywka opened this issue Nov 17, 2009 · 3 comments
Closed

Fix file upload issues with Opera #3

mpokrywka opened this issue Nov 17, 2009 · 3 comments

Comments

@mpokrywka
Copy link

Despite changes that should fix Opera issues, 2.36 doesn't work correctly for me in Opera.
I tested 9.27, 9.52, 9.64 and 10.00 under Ubuntu, upload is always interrupted early.
When searching for Opera iframe onload issues, I found note
in http://developer.yahoo.com/yui/releasenotes/README.connection and
that 2.5.2 issue description gave me idea how to fix this bug:
attach onload handler after iframe is inserted into DOM!

After applying following patch, form plugin works flawlessly under Opera (9.27, 9.52, 9.64, 10.00), I also tested (without problems) IE6,7,8 and Fx2,Fx3.

diff --git a/public/javascripts/jquery.form.js b/public/javascripts/jquery.form.js
--- a/public/javascripts/jquery.form.js
+++ b/public/javascripts/jquery.form.js
@@ -261,7 +261,9 @@ $.fn.ajaxSubmit = function(options) {

                                // add iframe to doc and submit the form
                                $io.appendTo('body');
+                               setTimeout(function() {
                                io.attachEvent ? io.attachEvent('onload', cb) : io.addEventListener('load', cb, false);
+                               }, 1);
                                form.submit();
                        }
                        finally {
@mworrell
Copy link

I second this, though I got the impression that the first onload event was triggered by the 100 continue, and that the second was triggered by the actual data received. Maybe I am wrong, at least my fix was very similar :-)

@mpokrywka
Copy link
Author

I uploaded my changes to github, see: http://github.com/mpokrywka/form
You are welcome to test them, FYI: on my site I use options:
{
iframe: true,
iframeSrc: 'javascript:false'
}

@malsup
Copy link
Collaborator

malsup commented Mar 11, 2010

I believe this is fixed in version 2.40

This issue was closed.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants