Change default Webbrowser in OSX

Dear All,

Does anybody know how to AS the change the default browser in OSX …?

Open System Preferences, Click on Internet, Select the Web tab, Choose your favorite / needed browser

I think for now you are limited to mucking around with a plist or using GUI scripting. Neither option is very appealing. :?

How about if you wanted to GET the user’s default browser info? (IE, Safari, Opera, etc). Would that also involve parsing some plist, or does Applescript have a command to provide that automatically?

This is what I use in OS X 10.2.8 (not my code). The handler returns the path to the default browser but this snippet gets the name.

set def_browser to displayed name of (info for alias GetDefaultBrowser())

on GetDefaultBrowser()
	set creatorType to word -1 of (do shell script ¬
		"defaults read com.apple.LaunchServices |grep -C5 E:html  | grep -w LSBundleSignature")
	set {text:creatorType} to (text of creatorType) as text
	tell application "Finder"
		set {defBrowserName, browserContainerAlias} to ¬
			{name, container} of application file id creatorType
	end tell
	return (browserContainerAlias as text) & defBrowserName
end GetDefaultBrowser

– Rob

I got an error 1 at the do shell command after copy/pasting the script.
But after replacing the character just before the “| grep” with a single space, it was working fine.

Thanks (especially after half a year!)

WARNING!

I know for various users that the string “E:html” is not contained in all OSs.

Thanks for the warning, JJ. Unfortunately, the code isn’t mine (I think I poached it from someone on applescript-users) and I don’t know how to address the issue. :confused:

– Rob

So what does this single letter mean? ‘E’ is for “extension”? How about “U:http”?

Does this technique work in Panther as well? I’m getting lots of plug-in info, like Quicktime and RealNetworks stuff, but I don’t get any information about the default browser in OS X.

Using “U:http” should work for most of systems.