open URL in browser

Discussion in 'Mac Programming' started by McBgnr, Jun 1, 2009.

  1. McBgnr macrumors regular

    Apr 13, 2009

    I am using the following code to open URL in the browser:
    [[NSWorkspace sharedWorkspace] openURL:LinkURL];
    I was assuming that this will open the URL in Safari, but I just realized that it opens the URL in default browser.

    So now how can I open the URL in a specific browser say "FireFox" when it is not the default browser. We have the terminal command open -a to open file in specific browsers. So an option is to run the command using NSTask. Was just wondering if there is any other option to do so.

    On another note, I am interested in knowing the place where Mac maintains the name of the default browser?
  2. robbieduncan Moderator emeritus


    Jul 24, 2002
  3. McBgnr thread starter macrumors regular

    Apr 13, 2009
    I was able to open URL in specified browser. Thanks a bunch for the helpful links.

Share This Page