-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Fix "Download File" link in response-body in Internet Explorer #4256
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
Conversation
In internet explorer, the "Download File" button is shown as a link, but when clicked nothing happens. Right clicking the link and selecting Save as... will ignore file name, and only display the blob name. The file has the proper content though. Internet explorer uses window.navigator.msSaveOrOpenBlob to save files. Branching in this file, will allow proper functionality to the link, while having no breaking changes. This solves issues: swagger-api#3364 The error can be seen on this : http://swashbuckletest.azurewebsites.net/swagger/ui/index#/Image/Image_Put This way, the internet explorer little window in the middle of the bottom of the screen will pop up, with the proper filename.
|
IE the best browser to download a real browser |
|
Our clients uses Internet Explorer sadly, so we need to support them too. |
|
Looks like travis is acting up: Something like that happened to me, I just sent a commit to re-trigger the build in a few minutes and it completed sucessfully |
Update to triggger CI
|
Now you do have a valid error:
|
Spacing
|
All good :) |
|
Whopsie, on the close :D |
Removed whitespaces
|
There is no check for that it seems. Removed them. |
|
AwesomO |
| } | ||
|
|
||
| bodyEl = <div><a href={ href } download={ download }>{ "Download file" }</a></div> | ||
| if(window.navigator.msSaveOrOpenBlob) { |
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.
Please refactor this to use the window wrapper instead of a direct window reference 😄
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.
Done!
Imported window wrapper, and updated usage
Missing if update
Added extra check
|
Updated! |
shockey
left a comment
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.
LGTM
|
thanks, @kovyfive! |

The error can be seen on this :
http://swashbuckletest.azurewebsites.net/swagger/ui/index#/Image/Image_Put
When opened with Internet explorer, clicking the link does nothing.
Description
In internet explorer, the "Download File" button is shown as a link, but when clicked nothing happens.
Right clicking the link and selecting Save as... will ignore file name, and only display the blob name.
The file has the proper content though.
Internet explorer uses window.navigator.msSaveOrOpenBlob to save files.
Branching in this file, will allow proper functionality to the link, while having no breaking changes.
This way, the internet explorer little window in the middle of the bottom of the screen will pop up, with the proper filename.
Motivation and Context
The download link is not working in IE
Fixes #3364
How Has This Been Tested?
Built using NPM, added to WebApi project, built, opened Swagger, clicked on Download File link, and asserted the Save window appeared.
Screenshots (if appropriate):
Checklist
My PR contains...
src/is unmodified: changes to documentation, CI, metadata, etc.)package.json)My changes...
Documentation
Automated tests