jQuery的sourceMappingURL在apache中产生404错误 [英] sourceMappingURL from jquery generates 404 error in apache

查看:101
本文介绍了jQuery的sourceMappingURL在apache中产生404错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正在浏览apache日志并发现有趣的事情:

Was browsing through apache logs and found interesting thing:

当用户访问我包含jquery的任何页面时,apache尝试获取jquery-xxx.min.map文件,但失败并显示404错误.这是一个示例:

When a users access any page where I have included jquery, apache tries to get jquery-xxx.min.map file and failed with 404 error. Here is an example:

xxx.xxx.xxx - - [Date:TIME +0000] "GET /js/lib/jquery-1.10.2.min.map HTTP/1.1" 404 3134 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/537.36"

这并不奇怪,因为我显然没有此min.map文件. 我不喜欢这种行为.

This is not a surprise, because I clearly do not have this min.map file. I do not like this behavior.

在查找jquery源代码时,我已经找到

Looking in jquery source code, I have found

/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map

第一件事是此sourceMappingURL在注释中,没有其他匹配项.当我刚删除它时,404错误消失了.

First thing is that this sourceMappingURL is in the comment, and there is no other hits. When I just removed it, 404 error disappeared.

我毫不怀疑jquery的人知道他们在做什么,但是任何人都可以向我解释一下:

I have no questions that people from jquery knew what are they doing, but can anyone explain me:

  • 这个sourceMappingURL的意义是什么,它创建一些以404结尾的连接?

  • what is the point of this sourceMappingURL which creates some connection which ends up with 404?

删除此行时我会失去什么?

what am I loosing when I removed this line?

我能够找到的唯一相关的东西是此链接,据我了解(如果我错了,请纠正我):

The only relevant thing I was able to found is this link and as far as I understood (please right me if I am wrong) that:

  • 它会在IE中产生一些错误(我正在通过Chrome查看)
  • 已弃用(我当时正在使用最新版本的jQuery)
  • 它用于调试目的(尚未理解用于什么调试目的)

推荐答案

有几种方法可以消除该错误.

There are several ways to remove the error.

  1. 默认情况下,Chrome将启用源地图.您可以通过打开开发人员工具并更改常规设置来禁用此功能.取消选中启用源地图"选项.当然,这不会解决Apache上的错误.

  1. By default Chrome will enable source maps. You can disable this by opening the Developer Tools and changing the general settings. Uncheck the Enable source maps option. This of course won't fix the error on Apache.

更改页面以使用jQuery或Google提供的CDN,而不是使用本地版本.这将阻止您本地的Apache在日志中显示该问题.

Change your pages to use a CDN served by jQuery or Google rather than using a local version. This will stop your local Apache from showing the issue in your logs.

或者,您将不得不在本地版本的jquery-1.10-2.min.js的顶部重写注释以停止此错误.否则,您需要等待jQuery的补丁.

Alternatively, you will have to rewrite the comment at the top of your local version of jquery-1.10-2.min.js to stop this error. Otherwise you'll need to wait for a patch by jQuery.

发件人:

/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license
//@ sourceMappingURL=jquery-1.10.2.min.map
*/

收件人:

/*! jQuery v1.10.2 | (c) 2005, 2013 jQuery Foundation, Inc. | jquery.org/license */

sourceMappingURL是HTML5的一项功能,最近几个月进行了一些更改.

sourceMappingURL is an HTML5 feature which has under gone some changes in the last months.

请参阅以下与sourceMappingURL的最新更改相关的链接: sourceMappingURL和sourceURL语法已更改,2013年6月

See the following link related to recent changes to sourceMappingURL: sourceMappingURL and sourceURL syntax changed, June 2013

这篇关于jQuery的sourceMappingURL在apache中产生404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆