• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: open URL in default browser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open URL in default browser


  • Subject: Re: open URL in default browser
  • From: Mike Abdullah <email@hidden>
  • Date: Sat, 28 Mar 2009 12:06:55 +0000

There's nothing wrong with using Launch Services still. Jut because it's a C API, doesn't mean it's Carbon and "bad." NSWorkspace is just an Obj-C wrapper round some of LaunchServices.

On 27 Mar 2009, at 18:47, Nathaniel Cunningham wrote:

Greetings,
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
browser.


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
editor).


THanks,
Nathaniel
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >open URL in default browser (From: Nathaniel Cunningham <email@hidden>)

  • Prev by Date: Re: Is there any ordered list or balanced tree
  • Next by Date: re: Core Data: is fetching safe during validateForInsert:/validateForUpdate?
  • Previous by thread: open URL in default browser
  • Next by thread: Number of NSMetadataQuery objects limited?
  • Index(es):
    • Date
    • Thread