通过网络访问Windows共享文件夹中的文件
问题描述:
我正在尝试访问共享Windows文件夹中的文件(例如:pdf文件).
(使用FILE协议)
i'm trying to access to a file (ex: pdf file) on a shared windows folder.
(using the FILE protocol)
file://myShareServer/path/to/myFile.pdf
jquery ajax返回:
jquery ajax returns :
XMLHttpRequest cannot load file://myShareServer/path/to/myFile.pdf. Cross origin requests are only supported for HTTP.
我如何使用jquery javascript到达此文件
how can i reach this file with jquery javascript
ps:授予对服务器的所有访问权限.
我在服务器端使用ASP.NET MVC4
ps: all access to the the server are granted.
i'm using ASP.NET MVC4 on server side
我正在使用PDF.JS库运行pdf文件(问题在这里)
i'm using the PDF.JS library to runder pdf files (the problem is here)
答
您可以将其像计算机上的任何其他文件一样对待,并使其成为链接,因为链接没有像XMLHttpRequests这样的跨源策略.
You can treat it like any other file on your computer and make it a link as links don't have a cross origin policy like XMLHttpRequests.
<a href="file://myShareServer/path/to/myFile.pdf">Download the file</a>