Choose Application in AppleScript Dynamically
Daring Fireball: Some AppleScript advice from Gruber. The idea is to target either the active browser or, incase nothing is active, the default browser from within the script. There’s some juicy bits in here for AppleScripters. Highly recommended read.

