Chrome和Chrome Safari错误::不允许加载本地资源:file:/// D:/CSS/Style.css [英] Chrome & Safari Error::Not allowed to load local resource: file:///D:/CSS/Style.css
问题描述
当我在chrome或safari中访问我的aspx页面时,会在控制台中显示此错误
When I access my aspx page in chrome or safari it shows this error in console
不允许加载本地资源:file: /// D:/CSS/Style.css
Not allowed to load local resource: file:///D:/CSS/Style.css
在IE和FF中一切正常。
Everything works fine in IE and FF.
我使用外部CSS,通过
I use an external CSS which is linked in aspx page via
<link rel="stylesheet" media="all" href="file:///D:/CSS/Style.css" type="text/css" />
我已经尝试过所有的/& \斜杠..
I have tried all the combination of "/" & "\" slashes..
是否以错误的方式给出文件路径或其在这些浏览器中的任何安全异常(我以管理员身份登录)...
我做错了什么?
Whether I am giving file path in wrong manner or its any security exception in these browsers(I am logged in as administrator)... What am I doing wrong?
推荐答案
您不能从aspx页面访问本地资源服务器)。你试过一个相对路径从你的aspx页面到你的css文件,如此...
You wont be able to access a local resource from your aspx page (web server). Have you tried a relative path from your aspx page to your css file like so...
<link rel="stylesheet" media="all" href="/CSS/Style.css" type="text/css" />
上述假设您有一个名为 CSS
您网站的根目录如下:
The above assumes that you have a folder called CSS
in the root of your website like this:
http://www.website.com/CSS/Style.css
这篇关于Chrome和Chrome Safari错误::不允许加载本地资源:file:/// D:/CSS/Style.css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!