Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell Safari to load URL



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

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



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.