IE8 iframe/form problem #214

Closed
davegurnell opened this Issue Mar 7, 2014 · 2 comments

2 participants

@davegurnell

I think there is a problem with the iframe/form transport running in IE8, which doesn't let you programatically attach an onload handler to an iframe:

http://stackoverflow.com/questions/12910534/why-doesnt-ie8-handle-iframe-onload-events

This means the handler attached in FileAPI.XHR.js is never called:

https://github.com/mailru/FileAPI/blob/master/lib/FileAPI.XHR.js#L159

The Stack Overflow post above says the problem can be solved by attaching the onload handler in the HTML:

<iframe ... onload="foo(bar)">

Best regards,

Dave

@davegurnell davegurnell added a commit to davegurnell/FileAPI that referenced this issue Mar 7, 2014
@davegurnell davegurnell Start fixing #214 - workaround for bug in IE8 iframe onload implement…
…ation

IE8 doesn't honour onload listeners attached using Javascript. See:

    http://stackoverflow.com/questions/12910534/why-doesnt-ie8-handle-iframe-onload-events

This commit attaches the handler using HTML instead.

A further commit will be needed to reorder the code to avoid a race condition
where the iframe is initialized before the handler is setup.
223bc24
@davegurnell davegurnell added a commit to davegurnell/FileAPI that referenced this issue Mar 7, 2014
@davegurnell davegurnell Finish fixing #214 - workaround for bug in IE8 iframe onload implemen…
…tation

Reorder the code that sets up the iframe onload handler to ensure
the handler is defined before the iframe is added to the window.
8ddf48f
@davegurnell davegurnell added a commit to davegurnell/FileAPI that referenced this issue Mar 7, 2014
@davegurnell davegurnell Rebuild with fix for #214 dcf042c
@davegurnell

I've fixed the issue in three commits to clarify the approach:

  1. davegurnell@223bc24
    This commit attaches the onload handler in the HTML rather than using Javascript.

  2. davegurnell@8ddf48f
    This commit moves the code that defines the onload handler before the definition of the HTML
    to avoid a race condition.

  3. davegurnell@dcf042c
    This commit rebuilds the dist directory.

The tests pass and I've independently verified that the code works on IE8 and 9 (Win7), Chrome, Firefox 26, and Safari 7 (OS X Mavericks). I'll verify IE10 and 11 and send a PR.

@RubaXa

Thanks a lot, send PR.

@davegurnell davegurnell referenced this issue Mar 7, 2014
Merged

Ie8iframe #215

@RubaXa RubaXa closed this in #215 Sep 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment