Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 412
Patrick from NDepend team Avatar asked Nov 07 '22 03:11

Patrick from NDepend team


1 Answers

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.

like image 174
wp78de Avatar answered Nov 12 '22 17:11

wp78de