尝试从本地存储加载jsp中的pdf文件时出错。 [英] Getting error while trying to load a pdf file in jsp from local storage.

查看:76
本文介绍了尝试从本地存储加载jsp中的pdf文件时出错。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆