Open doedje opened 10 years ago
There is no such check yet possible. Agreed that it would be good to have that. But for now only a TODO. Thanks for the hint to modernizr, looks interesting.
I'll check for Canvas since it is needed for PDF.js (see: https://github.com/mozilla/pdf.js/wiki/Required-Browser-Features)
Too bad, IE9 does have a canvas but is not showing my document. I had to do a better test and wanted to share the results with you (and other Viewer.js users).
First I mention the sites I used to come to my results: http://mozilla.github.io/pdf.js/features/ - A testpage that shows you exactly what features are supported by your browser, what the impact of missing this feature is on the correct functioning of PDF.js and whether it was possible to emulate the feature in case it is missing.
http://modernizr.github.io/Modernizr/test/index.html - A testpage of all features detectable with Modernizr.
https://www.browserleaks.com/modernizr - Also testpage of Modernizr features, but a bit better readable. But since it is maintained by a third party it might fall behind.
With those pages open on different browsers that do and do not support Viewer.js I was able to come to the following test to build a fallback option for Viewer.js:
if (Modernizr.canvas && Modernizr.webworkers) {
// show the document with Viewer.js
} else {
// use old viewer to show the document
}
The browsers we wanted supported should have the following features:
When needed it can be expanded in the future with the following tests:
Using: Modernizr 2.8.3 (Custom Build) | MIT & BSD Build: http://modernizr.com/download/#-canvas-webworkers-testprop-testallprops-domprefixes-dataview_api-file_api
This week I discovered (or rather collegues of me did) that REALLY old browsers: Safari 5.1.1 and Firefox 12 do pass the modernizr tests I used but do not properly display Viewer.js (we see the interface but no document) I will look into the why and maybe build a more specific test, but with all those browsers (desktop, phones and tablets) it is a pain in the a.......... ;)
On Tuesday 21 April 2015 04:02:31 Remy Blom wrote:
This week I discovered (or rather collegues of me did) that REALLY old browsers: Safari 5.1.1 and Firefox 12 do pass the modernizr tests I used but do not properly display Viewer.js (we see the interface but no document) I will look into the why and maybe build a more specific test, but with all those browsers (desktop, phones and tablets) it is a pain in the a.......... ;)
If you can come up with a reliable way to detect if browser will support viewerjs, we can add a warning message when the viewer is loaded in an unsupported browser.
Cheers, Jos
What feature should I check for to see if Viewer.js will work in my target browser? Is there a check in modernizr I can use?
I want to do something like this:
(and why is this not properly documented?)