开发者

gzipping a minified .js file

开发者 https://www.devze.com 2023-02-21 23:49 出处:网络
I\'ve minified a .js file, and everything is just fine. But, when I gzip, the browser no longer executes the file. What am I doing wrong? Here\'s the gzip command:

I've minified a .js file, and everything is just fine. But, when I gzip, the browser no longer executes the file. What am I doing wrong? Here's the gzip command:

> gzip test.js

Which results 开发者_JAVA技巧in a regular gzip file called test.js.gz. Do I need to include something in the .js, or pass an added argument to gzip so the browser interprets the file correctly? I tested this with both Chrome and FF.

Thank you advance!


This isn't a client side problem.

Your web server has to be configured to recognise the gzipped file, and send the appropriate Content-Encoding: gzip header to tell the browser to expect gzipped data.

0

精彩评论

暂无评论...
验证码 换一张
取 消