通过网络访问Windows共享文件夹中的文件 [英] Access to files on a windows shared folder over network

查看:344
本文介绍了通过网络访问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>

这篇关于通过网络访问Windows共享文件夹中的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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