错误"不准加载本地资源:文件:// sharedpath" [英] Error "Not allowed to load local resource: file://sharedpath"

查看:209
本文介绍了错误"不准加载本地资源:文件:// sharedpath"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在铬服务器(的NodeJS)运行时,低于code不能正常工作

The below code is not working when running on server(nodejs) in chrome

<span><a href="file://sharedpath" target="_blank">Open folder.</a></span>

我在开发者工具得到以下错误信息:

I am getting the following error message in the developer tool:

不允许加载本地资源:文件:// sharedpath

Not allowed to load local resource: file://sharedpath

但打开相同的路径时(文件:// sharedpath )在浏览器(新标签),我能够看到路径的文件夹结构。
同样是在IE浏览器工作正常。
这是Chrome的一个问题?或服务器上运行时,这是一个问题?
任何人都可以建议在这个问题上的东西吗?

But when opening the same path(file://sharedpath) in the browser(new tab), I am able to see the folder structure of that path. The same is working fine in IE. Is this a problem with Chrome? Or is this a problem when running on the server? Can anyone suggest something on this issue?

推荐答案

请确保您的主机是完全合格的:
来源

Make sure that your host is fully qualified: Source

试着增加一个额外的斜线:的file:/// sharedpath

Try adding an additional slash: file:///sharedpath

请参阅此回答

具体做法是:

有些浏览器,如Chrome的现代版本,甚至会拒绝来自HTTP协议的文件协议,以交叉,所以你最好确保你打开这个本地使用的文件协议,如果你想在所有做的东西

Some browsers, like modern versions of Chrome, will even refuse to cross from the http protocol to the file protocol, so you'd better make sure you open this locally using the file protocol if you want to do this stuff at all.

这篇关于错误&QUOT;不准加载本地资源:文件:// sharedpath&QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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