Edge browser appears to discard response payload

僤鯓⒐⒋嵵緔 提交于 2019-12-20 04:22:08

问题


I have a web app that returns a PDF to the browser, which works fine in Chrome and Firefox, however it does not work in Edge (version 38.14393.0.0). The response header looks like this:

   Access-Control-Allow-Headers: Content-Type, Authorization
   Access-Control-Allow-Origin: *
   Cache-Control: no-store, no-cache, must-revalidate
   Content-Disposition: inline; filename="Invoice.PDF"
   Content-Length: 9255
   Content-Type: application/pdf
   Date: Mon, 30 Jan 2017 04:38:25 GMT
   Pragma: no-cache
   Server: Microsoft-IIS/10.0

I've seen other questions suggesting that 2 requests are sent from Edge, one of which should be ignored, but in my case there is only one, and it appears that the payload is being ignored because Edge reports:

This resource has no response payload data

..which is in the Response Body section for the request in the Network analyzer in Developer Tools. Using attachment instead of inline also does not work, and I wouldn't expect it to if Edge thinks there's no content in the response.

Any clues?

Edit: When the Content-Type is changed to: text/plain, the response body is no longer being discarded (but does not solve the problem), so I assume it's something specific to application/pdf


回答1:


In my case, it appears the payload data is being discarded because I was attempting to use createObjectURL on the result. This post:

Setting window.location or window.open in AngularJS gives "access is denied" in IE 11

Has a solution that kind of works: Edge still does not actually open the PDF like other browsers are capable of, however it gives the user the option to save it.



来源:https://stackoverflow.com/questions/41929282/edge-browser-appears-to-discard-response-payload

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!