错误消息“DevTools 无法加载 SourceMap:无法加载 chrome-extension://...的内容"; | 的内容
本文介绍了错误消息“DevTools 无法加载 SourceMap:无法加载 chrome-extension://...的内容";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述 我正在尝试显示从本地计算机中选择的图像,我需要该图像的位置用于 JavaScript 函数,但无法获取图像的位置.
为了获取图像位置,我尝试使用 console.log ,但没有任何返回.
console.log(document.getElementById(uploadPreview"));
这是 HTML 代码:
<头><title></title>头部><身体><div align="center";style="padding-top: 50px"><img align="center";id="上传预览"样式=宽度:100px;高度:100px;"/>
<div align="center";style="padding-left: 30px"><input id="uploadImage";类型=文件"名称=我的照片"onchange="PreviewImage();";/>
<script type="text/javascript">功能预览图像(){var oFReader = new FileReader();oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);oFReader.onload = 函数(oFREvent){document.getElementById("uploadPreview").src = oFREvent.target.result;console.log(document.getElementById("uploadPreview").src);};}
</html>
控制台输出:
这里是警告:
DevTools 加载 SourceMap 失败:无法加载内容chrome-extension://alplpnakfeabeiebipdmaenpmbgknjce/include.preload.js.map:HTTP 错误:状态码 404,net::ERR_UNKNOWN_URL_SCHEME
解决方案
那是因为 Chrome 添加了对源映射的支持.
转到开发者工具 (浏览器中的),然后选择右上角的三个点 ,然后转到设置 .
然后,寻找来源 ,并禁用选项:
启用 JavaScript 源映射" 启用 CSS 源映射" 如果你这样做,那将消除警告.它与您的代码无关.检查其他页面中的开发者工具,您会看到相同的警告.
I'm trying to display an image selected from the local machine and I need the location of that image for a JavaScript function and am unable to get the location of the image.
To get the image location, I tried using console.log , but nothing returns.
console.log(document.getElementById("uploadPreview"));
Here's the HTML code:
<!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>
Console Output:
Here's the warning:
解决方案
That's because Chrome added support for source maps.
Go to the developer tools ( in the browser), then select the three dots in the upper right corner, and go to Settings .
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