Open a url using safari

HI - I am trying to open a web url by launching safari in Cocoa. I looked at NSWorkspace class method, but was unable to get anything to work.

set theURL to current application’s NSURL’s URLwithString_(“http://www.macscripter.net”)

Could someone help me with this please.

Best,
t.

Hi,

usually


set theURL to current application's |NSURL|'s URLWithString:"http://www.macscripter.net"
current application's NSWorkspace's sharedWorkspace()'s openURL:theURL

Hi Stefan

Thank you for your reply. I got this to work earlier but only if Safari is the default browser. I need to specify the Browser and in my case is Safai. Many of our staff use either Firefox or Chrome as their default browser. If there is something like openURL:withApplication then this will be perfect

Thanks,
t.

openURL: uses the default browser specified in launch services

Thank yo Stefan

Regards,
t.