Cocoa: help: adding web links to menu bar?

jayholley

Registered
I'm hoping someone could tell me how to make menu items web links or at least point me in the right direction, e.g. in the file menu there would be an option 'Go to my web site', and it would launch whatever web browser is specified in Internet Config, etc., and go to the site. I've tried searching for documentation on how others have done this, but can't find anything.
 
Well, easiest way to do this is make an action in one of your controllers in a nib file named "goToMyWebsite" or something else creative and put this in it:

Code:
(IBAction)goToMyWebSite:(id)sender
{
	[[NSWorkspace sharedWorkspace] openURL:[NSURL urlWithString:@"http://my.great.website/at/somewhere/cool"]];
}

Hope that helps. If you have any questions, just ask.
 
Back
Top