mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-05-13 18:27:04 +00:00
pdf 添加跨域功能 修复pdf 页码和高亮没启用bug
This commit is contained in:
@@ -23083,24 +23083,26 @@ initCom(PDFViewerApplication);
|
||||
}
|
||||
{
|
||||
const HOSTED_VIEWER_ORIGINS = new Set(["null", "http://mozilla.github.io", "https://mozilla.github.io"]);
|
||||
var validateFileURL = function (file) {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
const viewerOrigin = URL.parse(window.location)?.origin || "null";
|
||||
if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) {
|
||||
return;
|
||||
}
|
||||
const fileOrigin = URL.parse(file, window.location)?.origin;
|
||||
if (fileOrigin === viewerOrigin) {
|
||||
return;
|
||||
}
|
||||
const ex = new Error("file origin does not match viewer's");
|
||||
PDFViewerApplication._documentError("pdfjs-loading-error", {
|
||||
message: ex.message
|
||||
});
|
||||
throw ex;
|
||||
};
|
||||
var validateFileURL = function (file) {
|
||||
if (!file) {
|
||||
return;
|
||||
}
|
||||
const viewerOrigin = URL.parse(window.location)?.origin || "null";
|
||||
if (HOSTED_VIEWER_ORIGINS.has(viewerOrigin)) {
|
||||
return;
|
||||
}
|
||||
/* 注释掉跨域检查
|
||||
const fileOrigin = URL.parse(file, window.location)?.origin;
|
||||
if (fileOrigin === viewerOrigin) {
|
||||
return;
|
||||
}
|
||||
const ex = new Error("file origin does not match viewer's");
|
||||
PDFViewerApplication._documentError("pdfjs-loading-error", {
|
||||
message: ex.message
|
||||
});
|
||||
throw ex;
|
||||
*/
|
||||
};
|
||||
var onFileInputChange = function (evt) {
|
||||
if (this.pdfViewer?.isInPresentationMode) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user