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

Specifies default workerSrc (if possible)

This commit is contained in:
Yury Delendik 2013-08-16 11:12:52 -05:00
parent 5ca1c84564
commit 3f530c43a9
2 changed files with 20 additions and 6 deletions

View file

@ -34,3 +34,16 @@ if (typeof PDFJS === 'undefined') {
//#expand __BUNDLE__
}).call((typeof window === 'undefined') ? this : window);
//#if !(MOZCENTRAL || FIREFOX)
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');
})();
}
//#endif