How to enable apparently incompatible extensions in Firefox 3

Browser No Comments »

I have done a lot of testing with Firefox 3 beta, since it will be released soon and I want to get to know the new features and enjoy the improvements. If you duplicate your old Firefox profile (run "firefox -P" to access the profile manager), you can use both versions on the same system - but only instances of one version to the same time. This works pretty well, so that I have one butter-and-bread tool (thanks for this term, Thomas ;-) ) for my daily work and one unstable, experimental one for testing.

Update:
On OS X you can run both versions at the same time. Awesome! :-)

Unfortunately there are some extensions which do not work with Firefox 3, since their authors have not tested and qualified them to work perfectly with the new version.

Luckily, you can easily install extensions, even if they are not qualified the new version.

  1. Download the extension file to your computer.
  2. Unzip the xpi file (it behaves like a zip file) and open install.rdf with your favorite editor.
  3. Change the setting of em:maxVersion to 3.0 or higher (be sure that em:targetApplication is Firefox)
  4. Save the file and restore the xpi file.
  5. Open the extension from your local filesystem with Firefox 3 and install it.

Please note that using an unqualified extension is risky and can cause unexpected behavior and even browser crashes.

Optimization Monday — Part VIII: use function pointers

Optimization Monday 3 Comments »

Let us assume that you have a function which will execute different code based on conditions which do not change during runtime (e.g. the rendering engine of the user agent).

function doStuff(){
  if(userAgent == "internetexplorer"){
    // ...
  }else if(userAgent == "firefox"){
    // ..
  }else if(userAgent == "webkit"){
    // ..
  }else if(userAgent == "opera"){
    // ..
  }else{
    // ..
  }
}

Each time the function is called the string comparisons have to be done, even if the value for userAgent will not change at all.

To optimize this situation assign the actual function code to a variable named doStuff:

 
if(userAgent == "internetexplorer"){
  doStuff = function(){ /* .. */ };
}else if(userAgent == "firefox"){
  doStuff = function(){ /* .. */ };
}else if(userAgent == "webkit"){
  doStuff = function(){ /* .. */ };
}else if(userAgent == "opera"){
  doStuff = function(){ /* .. */ };
}else{
  doStuff = function(){ /* .. */ };
}
 

After this no more string comparisons are needed. :-)


WordPress Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in