Mar 26 2010

IE8 addEventListener Alternative Example

The W3C DOM Level 2 Event Model specifies addEventListener as the standard way to register event handlers but IE doesn’t support addEventListener. Instead IE provides an alternative attachEvent method for that purpose.

It does exactly the same thing but Microsoft decided to create their own method for the same purpose.

An example is given below shows how to provide cross browser compatibility for addEventListener:

someElement = document.getElementById('divName'); 


// for IE compatability

if (!someElement.addEventListener) {

    someElement.attachEvent("onclick", someFunction);


else {

    someElement.addEventListener("click", someFunction, false);


Please feel free to post other alternatives, if you know.

Mar 23 2010

Disabling Quicktime as Firefox Default mp3 Player

If you have Quicktime plugin for Firefox, annoyingly enough, Quicktime takes control and becomes the default mp3 player for your browser and leaving no option whatsoever to change the default mp3 player. Even if you change the  Tools -> Options -> Applications settings to change the default player, it will have no effect as Quicktime has already Hijacked this setting from users.

Now, we go brute force and restrict these kind of plugins to take such controls in the future:

  • Go to about:config
  • Type ‘plugin’ in the filter box (minus quotes)
  • Look for ‘plugin.disable_full_page_plugin_for_types’
  • If it already exists and contains a value, add ‘,audio/mpeg’ to the end of it, otherwise just change the value to ‘audio/mpeg’
  • Fully close Firefox, wait a few seconds for it to clean up and die
  • Launch Firefox again.. click an MP3 link..

voila! it does whatever you’ve specified in your Firefox Options -> Applications.

Page 1 of 11