[英]Not allowed to load local resource: file:///D
我正在使用来自终端的实时服务器从 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>
在 chrome 控制台中出现错误:
不允许加载本地资源:file:///D:/JAVASCRIPT/...
你不能使用本地资源 intel chrome 允许你这是因为安全原因 Chrome 默认不会加载本地文件。 所以你需要使用这个方法让谷歌加载你的本地资源:( https://kb.madcapsoftware.com/Content/Misc/GEN1011Z__-_Loading_local_files_in_Google_Chrome.htm )
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.