Fix for Safari and gzip compressed javascripts
Yesterday I showed how to use cgi.HTTP_USER_AGENT to not push gzipped javascripts to IE6. After fixing that guess who starts choking? IE’s bastard stepchild: Safari. I don’t trust Safari any more than I do IE. Unfortunately my client base uses it all the time: Designers!
After some digging around I learned that you cannot send compressed javascripts to Safari with the extension of “gz”. It must be “jgz”. Steve, you have got to be kidding me.
So here it is fixed… notice the modified filename in the Content-Disposition:
<cfif cgi.HTTP_ACCEPT_ENCODING contains "gzip" and cgi.HTTP_USER_AGENT does not contain 'MSIE 6.0; Windows'>
<cfheader name="Content-Encoding" value="gzip" >
<cfheader name="Content-Disposition" value="inline; filename=""protoaculous182min.jgz""">
<cfheader name="Content-Type" value="application/x-javascript; charset=ISO-8859-1">
<cfcontent deletefile="no" file="#expandpath('./protoaculous182min.gz')#" type="application/x-javascript; charset=ISO-8859-1">
<cfelse>
<cfheader name="Content-Disposition" value="inline; filename=""protoaculous182min.js""">
<cfheader name="Content-Type" value="application/x-javascript; charset=ISO-8859-1">
<cfinclude template="protoaculous182min.js">
</cfif>
Work flawless in Safari3, IE6, IE7, IE8, and Firefox3.

Recent Comments