Search code examples
cocoansbutton

Make NSButton a Hyperlink in Cocoa


I was wondering how to make an NSButton a hyperlink so it opens an external webpage in the user's default browser.

Thanks in advance!


Solution

  • -(IBAction)clicked:(id)sender {
        [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://stackoverflow.com"]];
    }