Jquery.min.map 404 (Not Found) causes of error and solutions

Source: Internet
Author: User

Information about Jquery.min.map 404 (not Found) appears after the Chrome update

What the hell is this thing? Query, got the following information

    • Official JQuery explanation

Extract the Content

There will be @ Sourcemappingurl=jquery.min.map in the original code after the JQuery 1.9.0 version

What is source map

Simply put, the Source map is an information file that stores the location information. That is, each position of the converted code, corresponding to the position before the conversion.

With it, when the error occurs, the Debug tool will display the original code directly, not the converted code. This has undoubtedly brought great convenience to the development.

Causes Jquery.min.map 404 reasons

After the update, Chrome opens the option to enable source maps, but you don't have the source map to cause the file to be found.

Solutions

Solution Mode 1.

Set Developer Tools, Enable source maps to close

Solution Mode 2.

Download the same version of source maps with Jquery.js directory

Source maps will be in the same position as jquery

Jquery location Http://code.jquery.com/jquery-1.10.2.min.js

Source Maps Location Http://code.jquery.com/jquery-1.10.2.min.map

When you open a page that introduces a jquery script, the error "GET Http://localhost/libs/jquery.min.map 404 (Not Found)" is reported in Chrome's console.

At first I thought it was a bug caused by the chrome installation plug-in, but when we switched the introduction to the jquery development version, the error disappeared. And only Chrome will have this error message, FireFox, IE will not error.

It turned out to be a curse in the jquery script " //@ sourceMappingURL=jquery-1.10.2.min.map ".

If it is arranged in a production environment, you can delete the above line of code directly.

If you are in a development environment, you should download the Jquery-1.10.2.min.map file and put it in the jquery sibling directory (you need the corresponding source map file).

If you want to turn off the error message, you can also uncheck enable source maps in Chrome's developer tools setting.

Why does the code that is commented out of this line work? Then you need to know what the source Map is.

What is source Map

The Source map is a JSON-formatted information file that stores the location information. In other words, it is a dictionary file that is compressed after JS. With it, when it goes wrong, the debugging tool will display the original code directly, not the compressed code. This undoubtedly brings great convenience to the developers.

Because it is a Google custom rule, only browsers based on chromium development support this feature for the time being.

Source Map Generation Tool

Closure compiler

Reference links
    • Introduction to JavaScript Source Maps
    • jquery Official Interpretation
    • JavaScript Source Map Detailed

Jquery.min.map 404 (Not Found) causes of error and solutions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.