Search code examples
firefox-addonmime-typesfirefox-addon-sdkpdf.js

How can I detect the current tab's mime type in a Mozilla Firefox extension?


I'm trying to do the same thing as asked in this question here, the only signification difference being the use of Mozilla Firefox instead of Google Chrome / Chromium .

I've tried using the Mozilla JetPack SDK and so far, for all content loaded with Mozilla's pdf.js viewer seems to be read as text/html . Is there a correct way to do this using Jetpack (or even XUL) in Firefox ?


Solution

  • I think you can detect a pdf rendered with pdf.js by checking if the document.baseURI property is set to "resource://pdf.js/web/"