Hey guys!,
Does anyone know what might be causing this to happen?
The file is uploaded correctly, it has the right permissions, and the <script>
tag points to it correctly.
The command I ran on the file was:
gzip file.js
What could it be?
Hey guys!,
Does anyone know what might be causing this to happen?
The file is uploaded correctly, it has the right permissions, and the <script>
tag points to it correctly.
The command I ran on the file was:
gzip file.js
What could it be?
Are you just trying to use the javascript file? Try pointing your browser at it, it may look quite garbled. GZIP is for file level compression not minifing javascript.
There are two concepts here: Type of the file and the Encoding used for transmission. You have to arrange for the server to know that the Type is application/x-javascript and the Encoding is x-gzip. Whether that gzip encoding happens on the fly at every download, or is done once in advance depends on server configuration.
Am I allowed to cite external web pages? Here's an example from somebody else's web page for how to configure Apache to support pre-compressed JS and CSS files:
# Compressed javascript files
AddEncoding x-gzip .jgz
AddType application/x-javascript .jgz
# Compressed css files
AddEncoding x-gzip .cgz
AddType text/css .cgz
Configuration for other servers (non-Apache) or for dynamic (not pre-compressed) server-side compression will differ.