【问题标题】:Unable to Load Image in Chrome (Not allowed to load local resource:)无法在 Chrome 中加载图像(不允许加载本地资源:)
【发布时间】:2021-10-21 14:52:01
【问题描述】:

测试浏览器:Chrome 版本:94.0.4606.81

当我运行 html 文件时,它没有显示,而是在控制台中显示错误`

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Image</title>
    <link rel="stylesheet" href="/Css/display.css">
</head>
<body>
    <div class="box1">
        <img src="C:\Users\first\OneDrive\Pictures\Downloaded Pictures\pexels-ella-olsson-1640777.jpg" alt="Cat Image"/>
    </div>
    <script src="/Js/function.js"></script>
</body>
</html>

Here's the Error Image

【问题讨论】:

    标签: html windows google-chrome web-development-server


    【解决方案1】:

    您不能只从本地磁盘加载文件。您应该使用您的代码将文件带到目录并更新路径。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-17
      • 1970-01-01
      • 2020-10-28
      • 2016-12-24
      • 2016-10-08
      相关资源
      最近更新 更多