"no enabled plugin supports this MIME type" message on mobile device for PDF document
Asked Answered
T

4

11

Recently the google search console reported a coverage issue on our ASP.NET website for the urls pointing to PDF documents.

So far in our web.config file we don't have any MIME setting for PDF documents. But indeed, both on localhost and in production, in Chrome, in mobile context PDF url generate empty content with the message no enabled plugin supports this MIME type:

no enabled plugin supports this MIME type

In Desktop context the PDF document is opened directly in Chrome.

Updating the web.config file with that (below) leads to the same described behavior, both in mobile and desktop contexts.

  <system.webServer>
      <staticContent>
        <remove fileExtension=".pdf" />
        <mimeMap fileExtension=".pdf" mimeType="application/pdf"  />
      </staticContent>
  <system.webServer>

Updating the web.config file with that (below) forces the browser to download the PDF in both contexts.

  <system.webServer>
      <staticContent>
        <remove fileExtension=".pdf" />
        <mimeMap fileExtension=".pdf" mimeType="application/octet-stream"  />
      </staticContent>
  <system.webServer>

So far this is the best solution since it allows mobile users to get the PDF and this will fix the google warning.

However I'd like to open the PDF in the browser itself in desktop context and download it in mobile context. Is it possible?

Thalweg answered 16/12, 2020 at 7:58 Comment(0)
B
2

The observed behavior is device/media-type specific; handling this at the web server level is challenging to put it mildly. There are some simple approaches but they take you only so far, some commercial IIS detection solutions can help.

I guess, making adjustments to the website would be probably more beneficial. There might be header issues, or acknowledging this behavior and manage the expectations.

Consistent behavior across mobile devices is difficult and there is simply no foolproof way to determine whether a device, mobile OS, or form factor is able to open in HTML-embedded PDF documents like it is the case on the desktop. The lowest common denominator of displaying an embedded document on all common browsers and devices is usually having a download link.

Bonniebonns answered 19/12, 2020 at 4:56 Comment(3)
Thanks, so there is no standard way in Web.Config to download PDF if device is mobile, and open PDF if device is desktop? Indeed I fall back to lowest common denominator with mimeType="application/octet-stream" that provoke downloading the PDFThalweg
No, unfortunately, this is what the first paragraph tries to wrap.Bonniebonns
Ok thanks I accepted your answer then and accepted that I cannot do what sounds straightforward at first glance: show PDF in browser if it supports PDF else download PDFThalweg
A
16

For me the issue was viewing the page in responsive mode, Chrome doesn't support showing pdf in this mode, switched to regular desktop mode and the PDF appeared. The mobile view can be tested by switching back to responsive mode after the file has been loaded.

Abamp answered 12/1, 2023 at 12:26 Comment(1)
Just had this happen to me while testing our product. Shut off DevTools and it the PDF displayed just fine.Hennery
B
2

The observed behavior is device/media-type specific; handling this at the web server level is challenging to put it mildly. There are some simple approaches but they take you only so far, some commercial IIS detection solutions can help.

I guess, making adjustments to the website would be probably more beneficial. There might be header issues, or acknowledging this behavior and manage the expectations.

Consistent behavior across mobile devices is difficult and there is simply no foolproof way to determine whether a device, mobile OS, or form factor is able to open in HTML-embedded PDF documents like it is the case on the desktop. The lowest common denominator of displaying an embedded document on all common browsers and devices is usually having a download link.

Bonniebonns answered 19/12, 2020 at 4:56 Comment(3)
Thanks, so there is no standard way in Web.Config to download PDF if device is mobile, and open PDF if device is desktop? Indeed I fall back to lowest common denominator with mimeType="application/octet-stream" that provoke downloading the PDFThalweg
No, unfortunately, this is what the first paragraph tries to wrap.Bonniebonns
Ok thanks I accepted your answer then and accepted that I cannot do what sounds straightforward at first glance: show PDF in browser if it supports PDF else download PDFThalweg
U
0

You can use the property navigator.pdfViewerEnabled when it is true, you can display pdf in the view, in other case you can create a html element link < a > and download the file.

Unpopular answered 14/5, 2024 at 16:3 Comment(0)
S
-2

I had the same error message for a relative PDF link at localhost, but the same url worked as expected when deployed to a live https url

Sonority answered 11/1, 2023 at 11:15 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.