1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Uses document.currentScript for pdf.worker.js path.

This commit is contained in:
Yury Delendik 2015-11-05 19:30:59 -06:00
parent 8079bdddb9
commit 28d340679a
2 changed files with 18 additions and 4 deletions

View file

@ -42,10 +42,8 @@ if (!PDFJS.workerSrc && typeof document !== 'undefined') {
// workerSrc is not set -- using last script url to define default location
PDFJS.workerSrc = (function () {
'use strict';
var scriptTagContainer = document.body ||
document.getElementsByTagName('head')[0];
var pdfjsSrc = scriptTagContainer.lastChild.src;
return pdfjsSrc && pdfjsSrc.replace(/\.js$/i, '.worker.js');
var pdfJsSrc = document.currentScript.src;
return pdfJsSrc && pdfJsSrc.replace(/\.js$/i, '.worker.js');
})();
}
//#endif