-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
UI: File API compat for IE #4376
Conversation
event.preventDefault(); | ||
let file = this.get('fileLike'); | ||
//lol whyyyy | ||
window.navigator.msSaveOrOpenBlob(file, file.name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this is annoying. Makes it harder to pretend that browsers are all the same.
It would be nice to hide all this msSaveOrOpenBlob
stuff in some polyfill rather than in this component, but if it's only going to be used here, I guess it's not so bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah @johncowen mentioned https://github.com/eligrey/FileSaver.js/ which may be worth looking at if this gives us any other issues. I think for now since it's just in this component we'll try this for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one non-blocking comment. Thank you for fighting the good fight.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can confirm this is working for me now. Thanks!
IE11 / Edge both don't seem to have a
File
constructor, so this detects the MS-specific API for saving Blobs, and will use it instead of using the File constructor to add download links to the UI.Before: it'd error out the rendering on the Show page leaving a blank textarea.
After:
Manually tested in IE11 Win7 (Note: we need to get cross-browser testing set up and getting the UI tests up and running in CI in general).