mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-09 01:35:43 +02:00
Add the docBaseUrl
API parameter to AppOptions
in the viewer
This unfortunately required a bit of special handling, to correctly deal with the various extension builds.
This commit is contained in:
parent
0cc0789af3
commit
ba2c042a75
2 changed files with 19 additions and 7 deletions
18
web/app.js
18
web/app.js
|
@ -642,16 +642,20 @@ let PDFViewerApplication = {
|
|||
this.setTitleUsingUrl(file.originalUrl);
|
||||
parameters.url = file.url;
|
||||
}
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||
parameters.docBaseUrl = document.URL.split('#')[0];
|
||||
} else if (typeof PDFJSDev !== 'undefined' &&
|
||||
PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
|
||||
parameters.docBaseUrl = this.baseUrl;
|
||||
}
|
||||
// Set the necessary API parameters, using the available options.
|
||||
const apiParameters = AppOptions.getAll(OptionKind.API);
|
||||
for (let key in apiParameters) {
|
||||
parameters[key] = apiParameters[key];
|
||||
let value = apiParameters[key];
|
||||
|
||||
if (key === 'docBaseUrl' && !value) {
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||
value = document.URL.split('#')[0];
|
||||
} else if (typeof PDFJSDev !== 'undefined' &&
|
||||
PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
|
||||
value = this.baseUrl;
|
||||
}
|
||||
}
|
||||
parameters[key] = value;
|
||||
}
|
||||
|
||||
if (args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue