If you are using multiple browsers, and are annoyed by Safari (or your designated preferred browser) popping up while using a different browser, this hint can remove that annoyance.
I'm a web developer, and while my main browser is WebKit, I also have Opera, Chrome and Firefox installed. If I'm using Opera and click a link in Mail, that link will open in Safari. So I wind up with two running browsers, or having to copy the URL over to Firefox manually. Not cool.
I have figured out a way to make an AppleScript 'proxy' app that delegates URLs to the browser that is currently running, no matter which is set as the default. Paste the following code into AppleScript Editor:
on open location the_url tell application "System Events" set browser_apps to the name of every process whose visible is true if "Opera" is in browser_apps then tell application "Opera" open location the_url activate end tell else if "firefox-bin" is in browser_apps then tell application "Firefox" open location the_url activate end tell else if "Google Chrome" is in browser_apps then tell application "Google Chrome" open location the_url activate end tell else tell application "WebKit" open location the_url activate end tell end if end tell end open location
Drill down into the app by Control-clicking on it, and choosing Show Package Contents from the pop-up menu. Navigate into Contents and open Info.plist in your favorite text editor, and paste this code near the end:
<key>CFBundleIdentifier</key> <string>nl.pepijndevos.urlhandler</string> <key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLName</key> <string>Applescript urls</string> <key>CFBundleURLSchemes</key> <array> <string>http</string> <string>https</string> <string>file</string> </array> <key>LSIsAppleDefaultForScheme</key> <true/> </dict> </array>
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100503134708927