DevTools无法加载SourceMap

DevTools无法加载SourceMap

本文介绍了DevTools无法加载SourceMap:无法加载chrome-extension的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试显示从本地计算机选择的图像,我需要该图像的位置才能使用javascript函数.我最近开始学习javascript.

I'm trying to display an image selected from the local machine and I need the location of that image for a javascript function. I have recently started learning javascript.

我遇到此错误,无法获取图像的位置.为了获取图像位置,我尝试使用 console.log ,但没有任何回报.

I am facing this error and unable to get the location of the image.For getting image location, I tried using console.log, but nothing returns.

console.log(document.getElementById("uploadPreview"));

这是HTML代码:

<!DOCTYPE html>
<html>
<head>
  <title></title>
</head>

<body>
  <div align="center" style="padding-top: 50px">
    <img align="center" id="uploadPreview" style="width: 100px; height: 100px;" />
  </div>

  <div align="center" style="padding-left: 30px">
    <input id="uploadImage" type="file" name="myPhoto" onchange="PreviewImage();" />
  </div>

  <script type="text/javascript">
    function PreviewImage() {
      var oFReader = new FileReader();
      oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);

      oFReader.onload = function (oFREvent) {
        document.getElementById("uploadPreview").src = oFREvent.target.result;
        console.log(document.getElementById("uploadPreview").src);

      };
    }
  </script>

</body>
</html>

控制台输出:

这是警告:

推荐答案

这是因为Chrome浏览器添加了对源地图的支持.

That's because Chrome added support for source maps.

转到开发人员工具(浏览器中为F12),然后选择右上角的三个点,然后转到设置 >.

Go to the developer tools (F12 in the browser), then select the three dots in the upper right corner, and go to Settings.

然后,查找来源,并禁用以下选项:启用javascript源地图"启用CSS源地图"

Then, look for Sources, and disable the options:"Enable javascript source maps""Enable CSS source maps"

如果您这样做,将会摆脱警告.它与您的代码无关.检查其他页面中的开发人员工具,您将看到相同的警告.

If you do that, that would get rid of the warnings. It has nothing to do with your code. Check the developer tools in other pages and you will see the same warning.

这篇关于DevTools无法加载SourceMap:无法加载chrome-extension的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-15 23:16