title: How to check if browser has pdf viewer or not in javascript
body: <p>I need to check if the browser has ability to show pdf in iframe.</p>
  <p>I was trying to simple check mimeTypes or plugins but now in Firefox on mac, it doesn't seem to be working fine, it shows empty array.</p>
  <pre><code>function isPDFSupported(): boolean {
    let hasPDFViewer = false;
    try {
      const pdf =
        navigator.mimeTypes &amp;&amp; (navigator.mimeTypes as any)['application/pdf']
          ? (navigator.mimeTypes as any)['application/pdf'].enabledPlugin
          : 0;
      if (pdf) hasPDFViewer = true;
    } catch (e) {
      if ((navigator.mimeTypes as any)['application/pdf'] != null) hasPDFViewer = true;
    }
  
    return hasPDFViewer;
  }
  </code></pre>
  <p>also check the developer.mozilla page for mimeTypes <a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mimeTypes" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Navigator/mimeTypes</a> and it shows that mimeTypes and plugin is deprecated...</p>
  <p>Do you know some other alternatives? or just simply do if IE download pdf and in other cases try to show pdf?</p>