diff --git a/seahub/templates/snippets/file_content_js.html b/seahub/templates/snippets/file_content_js.html index 2f0e77ef57..1cc9eccdba 100644 --- a/seahub/templates/snippets/file_content_js.html +++ b/seahub/templates/snippets/file_content_js.html @@ -92,7 +92,7 @@ window.onload = function () { {% endif %} {% if filetype == 'PDF' and use_pdfjs %} -if (!($.browser.msie && parseInt($.browser.version) < 10)) { +try { PDFJS.workerSrc = '{{MEDIA_URL}}js/pdf.worker.js'; $('#file-view').html('
'); PDFJS.getDocument("{{ raw_path|escapejs }}").then(function(pdf) { @@ -129,7 +129,7 @@ if (!($.browser.msie && parseInt($.browser.version) < 10)) { getPageAndRender(1); }); -} else { +} catch(e) { $('#file-view').html('

{% trans "You can use IE 10 or other browsers, for example, Firefox, to view it online." %}

'); } {% endif %} diff --git a/seahub/templates/view_file_pdf.html b/seahub/templates/view_file_pdf.html index 7d30aa5fb3..14f324ff4e 100644 --- a/seahub/templates/view_file_pdf.html +++ b/seahub/templates/view_file_pdf.html @@ -25,7 +25,7 @@ {% else %}