[Cosmo-dev] Gzipping dojo.js

Matthew Eernisse mde at osafoundation.org
Fri Feb 9 11:48:29 PST 2007


Since this is the initial page-level script tag for including the 
JavaScript, I'd much prefer to do it with a server-side tag.

Using document.write is pretty much the 'hack of last resort,' and 
something which in theory is not even usable in XHTML:

http://www.w3.org/MarkUp/2004/xhtml-faq#docwrite

Of course it does actually work in all our supported browsers, but I'd 
really prefer not to use it if we can avoid it -- particularly for 
something like the base script tag.

And as a BTW -- I'm not totally sure, but it looks like in Adam's 
example that IE will still be grabbing the gzipped file.

<script type="text/javascript" src="foo.js"></script>

If you have both foo.js and foo.js.gz in the directory, I think any 
browser that can handle gzipped content (including IE6, because it 
thinks it can support it) will try to grab foo.js.gz first if it can.

The reason it works may be that Adam has an up-to-date version of IE6 
where these bugs are fixed.

To get it to work the way we want, we'd need three files -- dojo.js, 
dojo.js.gz -- and then a filepath specifically for IE, so it doesn't try 
to grab the gz file -- dojo_dont_grab_the_compressed_file.js or some such.


M.

Jared Rhine wrote:
> Matthew Eernisse wrote:
>> Bottom line is that we need to be able to ensure that IE6 always gets 
>> the unzipped file -- regardless of what type of content it purports to 
>> accept.
> 
> A reasonable caveat thanks.  It seems entirely feasible to implement 
> needed behaviors based on user-agent; at least it would with Apache.
> 
> Feel free to test against http://lab.osaf.us/cosmo/, where mod_deflate 
> is enabled with no special treatment of browsers (so it should break on 
> IE6).  We can confirm both broken behaviors and server-side exclusions 
> of specific browsers when I get to it.
> 
> Just saw Adam's suggestion, which seems workable as well.  I had 
> originally envisioned having browsers just request dojo.js and have the 
> server negotiate resources, instead of browsers requesting different 
> versions.
> 
> -- Jared
> 
> _______________________________________________
> cosmo-dev mailing list
> cosmo-dev at lists.osafoundation.org
> http://lists.osafoundation.org/mailman/listinfo/cosmo-dev
> 



More information about the cosmo-dev mailing list