Probelm with Edge and ContentType="application/pdf" And content-disposition "inline;filename=report.pdf"

External Issue #7045462

Details

Created
Mar 29, 2016
Privacy
This issue is public.
Reports
Reported by 9 people

Sign in to watch or report this issue.

Steps to reproduce

URL:

Repro Steps:

Expected Results:

To open a new tab with the pdf file like all other browsers

Actual Results:

Dev Channel specific:

No

Posted by Aaronasdegsdg on 8/13/2015 at 3:33 PM

WARNING: This is a complete hack and runs the risk of breaking if/when Microsoft ever fixes this issue.

As I mentioned in my comment, earlier, you’ll see that Edge issues two requests whenever you view a PDF. To me, it looks like the browser is sending the initial request and then the PDF viewer is issuing its own request when it is opened. If you look at the headers in that second request, you’ll see an odd DLNA header coming down, which should just be for media streaming, but that leads me to my workaround…

  1. When the request is received in your handler or page, check if the user agent string contains “Edge/12.” If it doesn’t, send your PDF back normally. If it does, move on to step #2.
  2. Check if the HTTP Header “GetContentFeatures.DLNA.ORG” exists. If it doesn’t, that means that the request came from the browser. Just send back a Content-Type header of “application/pdf” and an empty body. If the header exists, then the request came from the PDF viewer and you can send your PDF back normally.

Basically, the handler treats that first request as a HEAD request and then responds with the full PDF if we determine that the request is coming from the PDF viewer. The risk we run here is if Microsoft removes that DLNA header later on, Edge will not render the PDF properly.

Posted by Eugene Friend on 3/21/2016 at 3:36 PM

This issue seems to be similar to this issue:
https://connect.microsoft.com/IE/feedback/details/1762233/edge-accept-language-header-strange-behavior

Still no solution but maybe this might increase the priority of the fix?

We’ve been struggling with this for a while, finally narrowed it down to the odd duplicate request behavior.

Posted by sphanley on 8/11/2015 at 8:06 AM

I want to confirm that in my workplace, we’re experiencing essentially the exact same thing that Aaronasdegsdg has described in his comment. In our application, we have the exact same sort of setup where we’re returning a PDF from a temporary database then deleting it, but edge, unlike other browsers where this works normally, is sending a duplicate request for the URL and therefore is erroring when the second request doesn’t have anything left to respond with.

Posted by Aaronasdegsdg on 8/3/2015 at 1:13 PM

I’m seeing a similar issue and it looks like it’s due to Edge making dual requests for any inline PDF. To test, you can run Fiddler or the Edge developer tools and navigate to any PDF on the web. You’ll notice that the browser is making two requests to the server. That second request can cause issues with dynamically-generated PDFs depending on how the PDF is generated.

In my case, I have a handler that returns a byte array from a temp database and immediately deletes it so we aren’t keeping a huge pdf byte array around any longer than we have to. When the second request comes though, my handler issues an exception because it can’t locate the byte array and the browser throws up the “Something’s keeping this PDF from opening.” error.

Attachments

0 attachments

    Comments and activity

    • Microsoft Edge Team

      Changed Assigned To to “Mara P.”

      Changed Assigned To to “Venkat K.”

      Changed Assigned To from “Venkat K.” to “Saranya K.”

      Changed Assigned To to “Amit K.”

      Changed Assigned To from “Amit K.” to “Anoop P.”

      Changed Assigned To from “Anoop P.” to “IE S.”

      Changed Status to “External”

    • Why is this marked as external and will this ever be fixed?

    • I am also facing same issue. Can you please update, what does status External mean and will it be ever fixed?

    You need to sign in to your Microsoft account to add a comment.

    Sign in