Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Addition for Multipart XHR #175

Open
balupton opened this issue May 2, 2012 · 5 comments
Open

Addition for Multipart XHR #175

balupton opened this issue May 2, 2012 · 5 comments

Comments

@balupton
Copy link

balupton commented May 2, 2012

Spec defined here https://developer.mozilla.org/en/xmlhttprequest and here http://msdn.microsoft.com/en-us/library/ie/hh673569(v=vs.85).aspx

So far all I know is that it is implemented in the latest Chrome, Firefox and IE10 (not IE9 or earlier)

Use case is file uploads via XHR

@paulirish
Copy link
Member

cool!

What should we say? Use? Warning?

what's the fallback story?

@balupton
Copy link
Author

balupton commented May 2, 2012

Tanks for that Paul, great questions.

According to jQuery File Upload (which would know best) the browser support is:

  • Firefox 4+
  • Safari 5+
  • Google Chrome

However IE10 should support as defined by microsoft's [article here](http://msdn.microsoft.com/en-us/library/ie/hh673569(v=vs.85\).aspx).

The fallbacks are:

  1. Use a 3rd party browser plugin. Requires that your user has the 3rd party plugin installed. Using flash supports cross domain with a crossdomain.xml. Flash polyfill is SWFupload. Many other 3rd party browser plugin polyfills are used in the library Plupload
  2. POST to an iframe. No browser requirements. Polyfill is jQuery Iframe Transport. For cross-domain uses it's a bit more complicated, as you don't have permission to read a cross-domain iframe (has no way to know if it completed or failed). To get past this, you have the options: 1. Use Pusher (or something similar) to notify the browser (cons of relying on a external service, con of delay). 2. Redirect the iframe back to the origin to either a special page or with a success or failure query string appended (con is that if you don't have access to the origin, the query string solution is not that nice).

The mentioned tools are probably best used with a proper library rather than just as utilities themselves (no point re-inventing the wheel). Libraries are jQuery File Upload (XHR or iframe), Plupload (supports every fallback known to man).

So it is a definite use with warning (and lots of them) feature.

Would you like me to submit it as a pull request and refine the above advice a bit more? If so, any suggestions on what the reformat should be like? If all these details are too much (or if we need more info) I'll be happy to post to my blog which could be used as reference.

Thanks :)

@paulirish
Copy link
Member

Nice. Let's do a PR.

The content above is good but yeah it's starting to get too long for h5p. I'd say turn it into a blog post (and maybe with a demo?)

And then the content for the PR will be borwser support, big ass link to your blog post and the exec summary. (also why multipart XHR matters :)

@arthurvr
Copy link
Member

@balupton Would you like to open a PR? :)

@balupton
Copy link
Author

I finished my contract at the company where I was utilising that feature, besides the information above, my memory is gone.

Perhaps one of the polyfill authors may be an option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants