一个计算机技术爱好者与学习者

0%

jQuery本地无法加载解决办法

1. 问题描述

环境:
win7+apache2.2+php5.2

症状:
jquery包文件(jquery-1.4.2.min.js)在本地测试的时候加载失败,通过firebug查看,发现文件被加载了两次,但每次都加载不完全。
直接引用外部的jquery包就OK,比如http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

2. 解决办法

参考Can’t load jquery on Apache,将httpd.conf中的

1
2
#EnableMMAP off
#EnableSendfile off

注释去掉,重启apache,在firefox下马上就生效了,在ie下需要删除下缓存。

这两个参数在httpd.conf有作了一些注释

1
2
3
4
5
6
7
8
#
# EnableMMAP and EnableSendfile: On systems that support it,
# memory-mapping or the sendfile syscall is used to deliver
# files.  This usually improves server performance, but must
# be turned off when serving from networked-mounted
# filesystems or if support for these functions is otherwise
# broken on your system.
#