I know this probably has been beaten to death before, but here is what I use for detecting the name of the default browser:
on getDefaultBrowserName()
try
set creatorType to word -1 of (do shell script ¬
"defaults read com.apple.LaunchServices | grep -A5 U:http\\b | grep -w LSBundleSignature")
set {text:creatorType} to (text of creatorType) as text
tell application "Finder" to set browserName to displayed name of application file id creatorType
return browserName
on error
return "Safari"
end try
end getDefaultBrowserName
My question is: this function will launch Finder if it’s not already running, and to certain users that run PathFinder for example as the default file manager this is annoying. Is there anyway around this?
Your script didn’t work for me in 10.3.4, but this does
GetDefaultBrowser()
on GetDefaultBrowser()
set creatorType to word -1 of (do shell script "defaults read com.apple.LaunchServices | grep -C5 U:http | grep -w LSBundleSignature")
set {text:creatorType} to (text of creatorType) as text
tell application "Finder"
(application file id creatorType)
end tell
end GetDefaultBrowser
--> application file "Safari.app" of folder "Applications" of startup disk of application "Finder"
No Finder Intervention
GetDefaultBrowser()
on GetDefaultBrowser()
set creatorType to word -1 of (do shell script "defaults read com.apple.LaunchServices | grep -C5 U:http | grep -w LSBundleSignature")
set {text:creatorType} to (text of creatorType) as text
end GetDefaultBrowser
--> sfri