尝试从本地存储加载jsp中的pdf文件时出错。 [英] Getting error while trying to load a pdf file in jsp from local storage.
问题描述
var url ='D:/Project/Documents/Invoices/invoices/invoice.pdf'; PDFJS.getDocument(url).then(function(pdf){
var elem = document.getElementById('myCanvas');
$(。document)。on('dblclick',function( ){
elem.addEventListener('dblclick',function(){
},false);
var index = $(this).attr(id);
});
});
这是我得到的错误
XMLHttpRequest无法加载file:/// D:/Project/Documents/Invoices/invoices/invoice.pdf。交叉原始请求仅支持协议方案:http,数据,chrome,chrome扩展,https,chrome-extension-resource。
我拥有什么尝试过:
我试过用这个命令禁用网络安全
chrome.exe --allow-file -access-from-files
(。document)。on('dblclick',function(){
elem.addEventListener(' dblclick',function(){
},false);
var index =
(this).attr(id);
} );
});
这是我得到的错误
XMLHttpRequest无法加载file:/// D:/Project/Documents/Invoices/invoices/invoice.pdf。交叉原始请求仅支持协议方案:http,数据,chrome,chrome扩展,https,chrome-extension-resource。
我拥有什么尝试过:
我试过用这个命令禁用网络安全
chrome.exe --allow-file -access-从档案
var url = 'D:/Project/Documents/Invoices/invoices/invoice.pdf'; PDFJS.getDocument(url) .then(function(pdf) { var elem = document.getElementById('myCanvas'); $(".document").on('dblclick',function() { elem.addEventListener('dblclick', function() { }, false); var index = $(this).attr("id"); }); });
This is the error i'm getting
XMLHttpRequest cannot load file:///D:/Project/Documents/Invoices/invoices/invoice.pdf. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
What I have tried:
I've tried disabling the web security by this command
"chrome.exe --allow-file-access-from-files"
(".document").on('dblclick',function() { elem.addEventListener('dblclick', function() { }, false); var index =
(this).attr("id"); }); });
This is the error i'm getting
XMLHttpRequest cannot load file:///D:/Project/Documents/Invoices/invoices/invoice.pdf. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
What I have tried:
I've tried disabling the web security by this command
"chrome.exe --allow-file-access-from-files"
这篇关于尝试从本地存储加载jsp中的pdf文件时出错。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!