简体   繁体   English

不允许加载本地资源:file:///D

[英]Not allowed to load local resource: file:///D

I am running this HTML program from visual studio using live-server from terminal我正在使用来自终端的实时服务器从 Visual Studio 运行这个 HTML 程序

cd<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Developer Skills & Editor Setup</title>
    <style>
      body {
        height: 100vh;
        display: flex;
        align-items: center;
        background: linear-gradient(to top left, #28b487, #7dd56f);
      }
      h1 {
        font-family: sans-serif;
        font-size: 50px;
        line-height: 1.3;
        width: 100%;
        padding: 30px;
        text-align: center;
        color: white;
      }
    </style>
  </head>
  <body>
    <h1>Developer Skills & Editor Setup</h1>
    <script src="D:\JAVASCRIPT\complete-javascript-course-master\complete-javascript-course-master\03-Developer-Skills\starter\script.js"></script>
  </body>
</html>

put I get an error in chrome console:在 chrome 控制台中出现错误:

Not allowed to load local resource: file:///D:/JAVASCRIPT/...不允许加载本地资源:file:///D:/JAVASCRIPT/...

1 2 error 1 2错误

you can't use local resources intel chrome allow you it's because of security reasons Chrome will not load local files by default.你不能使用本地资源 intel chrome 允许你这是因为安全原因 Chrome 默认不会加载本地文件。 so you need to use this method to make google load your local resources: ( https://kb.madcapsoftware.com/Content/Misc/GEN1011Z_-_Loading_local_files_in_Google_Chrome.htm )所以你需要使用这个方法让谷歌加载你的本地资源:( https://kb.madcapsoftware.com/Content/Misc/GEN1011Z__-_Loading_local_files_in_Google_Chrome.htm

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM