mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Merge pull request #3583 from yurydelendik/workerSrc
Specifies default workerSrc
This commit is contained in:
commit
88557041e0
2 changed files with 20 additions and 6 deletions
13
src/pdf.js
13
src/pdf.js
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue