How PDFObject detects PDF support
masterPDFObject uses a multi-layered detection strategy to determine if a browser can render PDFs inline:
- Mobile Detection: PDFObject automatically assumes PDFs are not supported on mobile devices (Android, iOS), as mobile browsers generally do not support inline PDFs. It will display fallback content instead.
navigator.pdfViewerEnabled: On non-mobile devices, PDFObject checks this property. If it istrue, the PDF is embedded. If it isfalse(user-disabled), PDFObject treats it as unsupported.- Fallback Logic: If
navigator.pdfViewerEnabledis unavailable, PDFObject checks the user agent:- Native Support: Browsers like Chrome, Edge, Opera, macOS Safari, and Firefox are assumed to support inline PDFs.
- Internet Explorer: PDFObject queries ActiveX for known PDF plugins like Adobe Acrobat or Foxit.
Note: Since version 2.3, PDFObject uses <iframe> elements by default instead of <embed> for better universal support and consistency.