The Js and CSS files are not getting compressing in SAFARI browser

I've compressed all the java scripts and style sheets as an individual files, after compression its about 582 KB. While it is loaded in the web page the chrome browser inspect elements network displays 168 KB, similarly when I browse in safari the network displays the file size as un-compressed 582 KB. It seems the compressing process has not occurred.

Many articles says that safari browser wont support the gzip compression.

Please guide me a to roll out this issue.!

Thanks in advance...!!

Upvotes: 0

Views: 831

Answers (2)

Jules
Jules

Reputation: 2021

Yes, send as jgz for it to work in Safari and add some headers for IE. Here is a coldFusion example:

<cfheader name="Content-type" value="text/javascript">
<cfheader name="Vary" value="Accept-Encoding">
<cfheader name="Content-Encoding" value="gzip">
<cfheader name="Content-Disposition" value="inline; filename=""#cacheKey#.jgz""">
<cfcontent file="#file#" deleteFile="no">

Alternatively you can opt to not compress the concatenated file in your code, and let your web server do that work for you. Then there is nothing to wonder about. Here is that example code in IIS (web.config):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <urlCompression doStaticCompression="true" doDynamicCompression="true" />
...

Live Example using IIS for gzipping. The download is 40KB. The unzipped content is 110KB. Safari only shows the unzipped size. But firebug shows the download size. Safari Screenshot Firebug Screenshot

Upvotes: 0

JalilIrfan
JalilIrfan

Reputation: 158

This is may not be a perfect solution but this may help you

Upvotes: 0

Related Questions