Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/roundcube/roundcubemail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2022-04-08 09:28:13 +0300
committerAleksander Machniak <alec@alec.pl>2022-04-08 09:28:13 +0300
commitff96c78606f05a6ecc649eda89aadc60daf017ee (patch)
treeb194c06794d1d24c07415fd00d80c547bdf7ecfe
parent5626e26c58eb2ff668f47732762eaa5170406080 (diff)
Use navigator.pdfViewerEnabled for PDF viewer detection
Drop ActiveXObject based detection code
-rw-r--r--CHANGELOG.md1
-rw-r--r--program/js/app.js22
2 files changed, 6 insertions, 17 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ca5c9b3ee..875d353f5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
## Unreleased
- Update to jQuery-UI 1.13.1 (#8455)
+- Use navigator.pdfViewerEnabled for PDF viewer detection
- Password: Add support for ssha256 algorithm (#8459)
- Fix slow loading of long HTML content into the HTML editor (#8108)
- Fix bug where SMTP password didn't work if it contained '%p' (#8435)
diff --git a/program/js/app.js b/program/js/app.js
index 26405387c..fdcc1249f 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -10012,29 +10012,17 @@ function rcube_webmail()
this.pdf_support_check = function()
{
+ if ('pdfViewerEnabled' in navigator)
+ return navigator.pdfViewerEnabled ? 1 : 0;
+
var i, plugin = navigator.mimeTypes ? navigator.mimeTypes["application/pdf"] : {},
- plugins = navigator.plugins,
- len = plugins.length,
regex = /Adobe Reader|PDF|Acrobat/i;
if (plugin && plugin.enabledPlugin)
return 1;
- if ('ActiveXObject' in window) {
- try {
- if (plugin = new ActiveXObject("AcroPDF.PDF"))
- return 1;
- }
- catch (e) {}
- try {
- if (plugin = new ActiveXObject("PDF.PdfCtrl"))
- return 1;
- }
- catch (e) {}
- }
-
- for (i=0; i<len; i++) {
- plugin = plugins[i];
+ for (i in navigator.plugins) {
+ plugin = navigator.plugins[i];
if (typeof plugin === 'string') {
if (regex.test(plugin))
return 1;