简体   繁体   中英

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

I am running this HTML program from visual studio using live-server from terminal

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:

Not allowed to load local resource: file:///D:/JAVASCRIPT/...

1 2 error

you can't use local resources intel chrome allow you it's because of security reasons Chrome will not load local files by default. 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 )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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