Error message "DevTools failed to load SourceMap: Could not load content for chrome-extension://..."

JavascriptHtml

Javascript Problem Overview


I'm trying to display an image selected from the local machine and I need the location of that image for a JavaScript function. But I'm unable to get the location.

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:

Enter image description here

Here's the warning:

> DevTools failed to load SourceMap: Could not load content for > chrome-extension://alplpnakfeabeiebipdmaenpmbgknjce/include.preload.js.map: > HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

Javascript Solutions


Solution 1 - Javascript

That's because Chrome added support for source maps.

Go to the developer tools (F12 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.

Solution 2 - Javascript

Go to Developer toolsSettingsConsole → tick "Selected context only". The warnings will be hidden. You can see them again by unticking the same box.

The "Selected context only" means only the top, iframe, worker and extension contexts. Which is all that you'll need, the vast majority of the time.

Solution 3 - Javascript

The include.prepload.js file will have a line like below, probably as the last line:

//# sourceMappingURL=include.prepload.js.map

Delete it and the error will go away.

Solution 4 - Javascript

I stumbled upon this Stack Overflow question after discovering loads of source map errors in the console for the Edge browser. (I think I had disabled the warnings in the Chrome browser long ago.)

For me it meant first realising what a source map is; please refer to Macro Mazzon's answer to understand this. Since it's a good idea, it was just a case of finding out how to turn them on.

It's as simple as adding this line in your webpack.config.js file -

module.exports = {
    devtool: "source-map",
}

Now that Edge could detect a source map, the errors disappeared.

Apologies if this answer insults anybody's intelligence, but maybe somebody reading this will be as clueless about source maps as I was.

Solution 5 - Javascript

For me, the problem was caused not by the application in development itself, but by the Chrome extension React Developer Tool. I solved it partially by right-clicking the extension icon in the toolbar, clicking "Manage extension" and then enabling "Allow access to files URLs." But this measure fixed just some of the alerts.

I found issues in the React repository that suggests the cause is a bug in their extension and is planned to be corrected soon - see issues 20091 and 20075.

You can confirm is extension-related by accessing your application in an anonymous tab without any extension enabled.

Solution 6 - Javascript

Fixing "SourceMap" error messages in the Development Tools Console caused by Chrome extensions:

Examples caused by McAfee extensions:

> DevTools failed to load SourceMap: Could not load content for chrome-extension://klekeajafkkpokaofllcadenjdckhinm/sourceMap/content.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

> DevTools failed to load SourceMap: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/content.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

> DevTools failed to load SourceMap: Could not load content for chrome-extension://fheoggkfdfchfphceeifdbepaooicaho/sourceMap/chrome/iframe_handler.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

If you are developing, then you need "Enable JavaScript source maps" and "Enable CSS source maps" checked to be able see your source code in Chrome Developer Tools. Unchecking those takes away your ability to debug your source code. It is like turning off the fire alarm instead of putting out the fire. You do not want to do that.

Instead you want to find the extensions that are causing the messages and turn them off. Here is how you do that:

  1. Go to the three dots in the upper right hand corner of Chrome.
  2. Go to "More Tools" and click on "Extensions".
  3. Do this for one extension at a time until no more "SourceMap" errors are in the console:
    1. Turn off the extension by sliding the switch to the left.
    2. Reload the page that you were using the Development Tools on.
    3. Check if any of the "SourceMap" error messages disappeared.
      1. If any did, then that extension was causing those messages.
      2. Otherwise, that extension can be turned back on.

After determining which extensions caused the issue either:

  1. If you need it, then contact the maker to have them fix the issue.
  2. Otherwise, remove the extension.

Solution 7 - Javascript

Right: it has nothing to do with your code. I've found two valid solutions to this warning (not just disabling it). To better understand what a source map is, I suggest you check out this answer, where it explains how it's something that helps you debug:

> The .map files are for JavaScript and CSS (and now TypeScript too) files that have been minified. They are called SourceMaps. When you minify a file, like the angular.js file, it takes thousands of lines of pretty code and turns it into only a few lines of ugly code. Hopefully, when you are shipping your code to production, you are using the minified code instead of the full, unminified version. When your app is in production, and has an error, the sourcemap will help take your ugly file, and will allow you to see the original version of the code. If you didn't have the sourcemap, then any error would seem cryptic at best.

  1. First solution: apparently, Mr Heelis was the closest one: you should add the .map file and there are some tools that help you with this problem (Grunt, Gulp and Google closure for example, quoting the answer). Otherwise you can download the .map file from official sites like Bootstrap, jQuery, font-awesome, preload and so on... (maybe installing things like popper or swiper by the npm command in a random folder and copying just the .map file in your JavaScript/CSS destination folder)

  2. Second solution (the one I used): add the source files using a CDN (content delivery network). (Here are all the advantages of using a CDN). Using content delivery network (CDN) you can simply add the CDN link, instead of the path to your folder. You can find CNDs on official websites (Bootstrap, jquery, popper, etc.) or you can easily search on some websites like Cloudflare, cdnjs, etc.

Solution 8 - Javascript

Extensions without enough permissions on Chrome can cause these warnings, for example for React developer tools. Check if the following procedure solves your problem:

  1. Right click on the extension icon.

Or

  1. Go to extensions.
  2. Click the three-dot in the row of React developer tool.

Then choose "This can read and write site data".

You should see three options in the list. Pick one that is strict enough based on how much you trust the extension and also satisfies the extension's needs.

Solution 9 - Javascript

I appreciate this is part of your extensions, but I see this message in all sorts of places these days, and I hate it: how I fixed it (this fix seems to massively speed up the browser too) was by adding a dead file

  1. physically create the file it wants it/where it wants it, as a blank file (for example, "popper.min.js.map")

  2. put this in the blank file

    {
     "version": 1,
     "mappings": "",
     "sources": [],
     "names": [],
     "file": "popper.min.js"
    }
    
  3. make sure that "file": "*******" in the content of the blank file matches the name of your file ******.map (minus the word ".map")

(I suspect you could physically add this dead file method to the addon yourself.)

Solution 10 - Javascript

I do not think the warnings you have received are related. I had the same warnings which turned out to be the Chrome extension React Dev Tools. I removed the extension and the errors were gone.

Solution 11 - Javascript

You have just missing files.

Go to this website https://www.cdnpkg.com/ download what you need and copy it to the right folder.

Solution 12 - Javascript

For me, the warnings were caused by the Selenium IDE Chrome extension. These warnings appeared in the Console on every page load:

DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/atoms.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/polyfills.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/escape.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/playback.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME
DevTools failed to load source map: Could not load content for chrome-extension://mooikfkahbdckldjjndioackbalphokd/assets/record.js.map: HTTP error: status code 404, net::ERR_UNKNOWN_URL_SCHEME

Since Selenium IDE was already set to be able to read site data on all sites, I uninstalled it. (I read on another comment here that you might try enabling more permissions for an extension instead of removing it.) In my case removing Selenium IDE (Chrome extension) got rid of the warnings.

Solution 13 - Javascript

It is also possible to add the file that is missing, aside with other .js libraries in the same folder (no need to reference the .map in the .html file, <script> tag).

I had the same error, when trying to code in Backbone.js.

The problematic file was backbone-min.js, and the line that created the error was sourceMappingURL=backbone-min.map.

After downloading the missing file (the link comes from here), the error disappeared.

Solution 14 - Javascript

You need to open Chrome in developer mode: select More tools, then Extensions and select Developer mode

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionsnehit vaddiView Question on Stackoverflow
Solution 1 - JavascriptDiego OñaView Answer on Stackoverflow
Solution 2 - JavascriptChandimaView Answer on Stackoverflow
Solution 3 - JavascriptRavikiran kalalView Answer on Stackoverflow
Solution 4 - Javascriptuser1849962View Answer on Stackoverflow
Solution 5 - JavascriptJoão MeloView Answer on Stackoverflow
Solution 6 - JavascriptDanny Remington - OMSView Answer on Stackoverflow
Solution 7 - JavascriptMarco MazzonView Answer on Stackoverflow
Solution 8 - JavascriptMooventhanView Answer on Stackoverflow
Solution 9 - JavascriptMr HeelisView Answer on Stackoverflow
Solution 10 - JavascriptJozadad1View Answer on Stackoverflow
Solution 11 - JavascriptAdam BonieckiView Answer on Stackoverflow
Solution 12 - JavascriptjdempcyView Answer on Stackoverflow
Solution 13 - JavascriptLéaView Answer on Stackoverflow
Solution 14 - JavascriptlamriniView Answer on Stackoverflow