简体   繁体   English

如何修复 microsoft edge 或 google chrome 中的“不允许加载本地资源”错误?

[英]How can I fix "Not allowed to load local resource" error in microsoft edge or google chrome?

I am trying to link an external javascript file to my HTML file.我正在尝试将外部 javascript 文件链接到我的 HTML 文件。 But as soon as I run it my console shows this error "Not allowed to load local resource".但是一旦我运行它,我的控制台就会显示此错误“不允许加载本地资源”。 I read about its cause but can anyone help me with how to fix this?我阅读了它的原因,但任何人都可以帮助我解决这个问题吗?

my statement:我的声明:

" " " "

I have tried using a static web server extension in Chrome but it's not working.我尝试在 Chrome 中使用 static web 服务器扩展,但它不起作用。

When it comes to debugging code, opening it from disk by "double clicking" the HTML file is rarely a good idea.在调试代码时,通过“双击”HTML 文件从磁盘打开它并不是一个好主意。 Try using a local server instead.尝试改用本地服务器。 There are a lot of great ones available.有很多很棒的。 I don't know what IDE you are using, but VSCode has Live Server for example which works great, or you can use XAMPP as a standalone solution.我不知道您使用的是什么 IDE,但 VSCode 有 Live Server,例如效果很好,或者您可以使用 XAMPP 作为独立解决方案。

Don't enter full path of image.. Example: DO NOT ENTER LIKE THIS : C:\Users\A1\Desktop\vs\images\cloud.png Enter LIKE THIS : iamges\cloud.png just ensure that your folder named images is inside your project folder不要输入图像的完整路径。示例:不要像这样输入:C:\Users\A1\Desktop\vs\images\cloud.png 像这样输入:iamges\cloud.png 只需确保您的文件夹名为 images在您的项目文件夹中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:使用 iframe 时“不允许加载本地资源:chrome://extensions” - ERROR : "Not allowed to load local resource: chrome://extensions" while using iframe 当我使用blob从ArrayBuffer加载资源时,为什么在Chrome上出现“不允许加载本地资源”错误? - Why I got `Not allowed to load local resource` error on chrome when I use blob to load resource from ArrayBuffer? 错误:不允许加载本地资源 - error: Not allowed to load local resource 不允许加载本地资源错误 - Not allowed to load local resource Error Chrome扩展程序:不允许加载本地资源 - Chrome Extension: Not allowed to load local resource 为什么会出现“不允许加载本地资源”错误消息? - Why do I get a “Not allowed to load local resource” error message? Chrome 扩展程序错误:不允许加载本地资源:chrome://new-tab-page - Chrome Extension Error: Not allowed to load local resource: chrome://new-tab-page 无法打开本地文件 - Chrome:不允许加载本地资源 - Cannot open local file - Chrome: Not allowed to load local resource 错误不允许在 javaScript 中加载本地资源 - Error Not allowed to load local resource in javaScript 节点错误-不允许加载本地资源 - Node Error - Not allowed to load local resource
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM