open URL in default browser

I'm new to Cocoa, and helping to port a carbon app to cocoa.

In particular, I want to be able to open an arbitrary URL in the default
internet browser, regardless of whether the URL refers to a local file that
normally opens in some other app (e.g. a jpeg image that opens in Preview),
or is a remote http: URL.

How can I (1) identify the App which constitutes user's default browser, and
(2) tell this App to open a specified URL?
[NSWorkspace openURL:] uses the default app for the URL, not necessarily a

The Carbon solution to this involved LSGetApplicationForURL(); I could use
[NSWorkspace getInfoForFile: application: type:]
but finding the default app for (say) an .html file is not the same as the
default for an http: URL (I don't want to open all URLs in someone's HTML


Cocoa-dev mailing list (Cocoa-dev@xxxxxxxxxxxxxxx)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)

Help/Unsubscribe/Update your Subscription:

This email sent to maillists@xxxxxxxxx