• 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: Tell Safari to load URL
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell Safari to load URL


  • Subject: Re: Tell Safari to load URL
  • From: Nicko van Someren <email@hidden>
  • Date: Mon, 3 Jan 2005 13:24:33 +0000

On 2 Jan 2005, at 15:06, Gregory Weston wrote:

Simon alias Trax wrote:

The title says it all...
I want to tell Safari to go to a particular URL.
If Safari is not opened, then my app will tell the Finder to open it, and
then go to the specified URL.

As joar noted, the preferred technique is to send openURL: to the default NSWorkspace. A couple of things worth noting:
a) This isn't going to go to Safari. It's going to go to whatever app is configured to handle URLs of the passed scheme on the user's machine. For HTTP that's Safari by default, but if you _need_ Safari this isn't reliable.
b) Your app doesn't need to make any effort to launch the app.

If you, for some strange reason, require the use of Safari in particular you can use the NSWorkspace message:
openURLs:withAppBundleIdentifier:options: additionalEventParamDescriptor:launchIdentifiers:
That said, if the user has a different default browser and it does not make a difference to you application which browser is used then Joar's suggestion is almost certainly better.


	Nicko

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: Tell Safari to load URL (From: Gregory Weston <email@hidden>)

  • Prev by Date: Re: Cocoa Bindings - nondebuggable, non-obvious, procedural ???
  • Next by Date: OT request: Shareware anti-cracking - need info
  • Previous by thread: Re: Tell Safari to load URL
  • Next by thread: Detect changing font
  • Index(es):
    • Date
    • Thread