Comments (8)
Hi Janne. Yes, I plan to incorporate pdfViewerEnabled
. I've been waiting for it to be more widely supported. Thanks for the reminder, it looks like all the major browser vendors made a big push over the past year to roll out pdfViewerEnabled
. Safari iOS finally adopted it in March as part of iOS 16.
There are still plenty of older browsers and OSes that won't support pdfViewerEnabled
, so there will need to be conditional logic that falls back to the older approaches when needed.
I don't have an ETA but I'll work on it soon.
from pdfobject.
The logic would look something like this. First, use the pdfViewerEnabled
value if there is one. Second, exclude mobile devices. Third, check for a modern browser, PDF.js, etc.
function supportsPDFs() {
let pdfViewerEnabled = window.navigator.pdfViewerEnabled;
if (typeof pdfViewerEnabled === "boolean") {
return pdfViewerEnabled;
}
if (isMobileDevice) {
return false;
}
if (isModernBrowser || isFirefoxWithPDFJS || (isIE && supportsPdfActiveX())) {
return true;
}
return false;
}
from pdfobject.
Thanks, yes this is the direction I'm headed. I also plan to refactor to eliminate unnecessary checks/declarations where possible, such as the IE ActiveX check.
from pdfobject.
@jhyot I just uploaded a beta version of 2.3 which has some significant changes, including introducing navigator.pdfViewerEnabled
. I've tested against all major browsers, locally and via BrowserStack. Everything works as expected in my tests.
I'd appreciate it if you can check it out and let me know if you encounter any issues. https://pdfobject.com/dev/ and https://github.com/pipwerks/PDFObject/tree/2.3-dev (changes are listed in the 2.3 branch readme). Thanks
from pdfobject.
I haven't done extensive testing, but I read through the recent commits, and it looks good to me. The only problem I noticed (a missing typeof
) was already fixed.
from pdfobject.
Does the mobile browser support change after this? Is there a updated table somewhere which mobile browsers work?
from pdfobject.
Mobile browsers still do not support inline PDFs. https://caniuse.com/pdf-viewer
Safari for iOS displays the first page of a PDF, and without any PDF toolbar, so it's considered a broken implementation.
from pdfobject.
@jhyot I just uploaded a beta version of 2.3 which has some significant changes, including introducing
navigator.pdfViewerEnabled
. I've tested against all major browsers, locally and via BrowserStack. Everything works as expected in my tests.I'd appreciate it if you can check it out and let me know if you encounter any issues. https://pdfobject.com/dev/ and https://github.com/pipwerks/PDFObject/tree/2.3-dev (changes are listed in the 2.3 branch readme). Thanks
@pipwerks I am currently not using PDFObject, so cannot test it (my original question arose during evaluation whether we could use it in future)
from pdfobject.
Related Issues (20)
- PDFObject Not Show and Only show Root File HOT 2
- Eraser HOT 1
- PDFObject save button option HOT 1
- Disabled download and print button HOT 1
- Use google docs PDF conversion for mobile devices? HOT 5
- [Documentation] Standalone examples of .html files + PDFObject? HOT 3
- Remove some buttons and only show one page at a time HOT 1
- Render html elements within "the full-browser embed" HOT 1
- Fails to load in IE11 HOT 8
- Is there a way to track button clicks? HOT 2
- PDFObject: Page option not working in Microsoft Edge HOT 2
- The problem occurred when using PDFObject in React: Page A embedded with duplicate Page A. HOT 3
- Cannot set properties of undefined HOT 1
- Prevent download pdf automatically HOT 1
- PDFObject is vulnerable to PDFInjection HOT 4
- XSS in fallback link if url is controllable by attacker HOT 5
- base64 PDF how to set title? HOT 1
- Sign PDF with digital certificate HOT 1
- change default download file name HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdfobject.