Archive for the ‘Javascript’ category

Extending Prototype’s Template class to allow default values

September 14th, 2011

I’ve often wanted to extend Prototype’s Template class to allow setting default values for template fields if the user doesn’t pass them, so I wrote a simple wrapper class that does just that.

» Read more: Extending Prototype’s Template class to allow default values

Hosting ga.js locally (google analytics tracking code)

June 22nd, 2010

Hosting ga.js locally has two main benefits – fewer DNS lookups for the client’s browser (you could even combine it with your site’s java script to reduce HTTP reqs as well), and you might be able to get it to your users faster than Google can. Whilst the second point isn’t likely true for many, it is true for those of us serving most of our content in Australia.

Google recommends you don’t do this, but doesn’t say you can’t.
» Read more: Hosting ga.js locally (google analytics tracking code)

Update “overflow: hidden” style of the HTML tag error in IE

March 16th, 2010

When trying to update the “overflow: hidden” style attribute of either the body or the html tag using JavaScript, unsurprisingly, IE throws an error… However using the magic of prototype I found a very simple way of achieving this that keeps Microsoft happy – even IE6.
» Read more: Update “overflow: hidden” style of the HTML tag error in IE