Can';t使用javascript中的fetch()API从本地目录获取文件

Can';t使用javascript中的fetch()API从本地目录获取文件,javascript,web,fetch,Javascript,Web,Fetch,我无法从本地目录获取文件:: async function getData() { const response = await fetch("dina.png"); const data = await response.blob(); document.querySelector("img").src = URL.createObjectURL(data); } getData(); 错误 错误:无法加载-文件路径

我无法从本地目录获取文件::

  async function getData() {
    const response = await fetch("dina.png");
    const data = await response.blob();
    document.querySelector("img").src = URL.createObjectURL(data);
  }
  getData();
错误

错误:无法加载-文件路径-。对于CORS请求,URL方案必须为“http”或“https”。getData@file.html:12(匿名)@file.html:16。 错误:未捕获(承诺中)类型错误:无法获取 在getData(file.html:12)中,在此处输入代码
在file.html:16中,使用http服务器,周围有很多简单的服务器-虽然chrome显然有一个命令行开关来启用这种功能,但是…您不能像这样访问本地文件系统,浏览器出于安全原因阻止了这一点。使用http服务器这是否回答了您的问题?请确保您的问题尚未得到回答。这确实表明你缺乏研究。