Skip navigation.
 
mlRe: Default Web Browser
FROM : Steve Dekorte
DATE : Sun Jan 26 23:03:02 2003

Vince DeMarco wrote:
> Steve Dekorte wrote:

>> How can I programmatically find which web browser is set to be the
>> default in the System/Internet preferences?

> look up the function LSGetApplicationForURL()


Thanks for the response. Should this code work?:

  {
    char *URL = "file://somefile.htm";
    FSRef appRef;
    CFURLRef appURL;

    CFStringRef urlStr = CFStringCreateWithCString(NULL, URL,
kCFStringEncodingASCII);
    CFURLRef inURL = CFURLCreateWithString(NULL, urlStr, NULL);

    OSStatus oss = LSGetApplicationForURL(inURL, kLSRolesEditor,
&appRef, &appURL);
    CFStringRef s = CFURLGetString(appURL);
    printf("appURL = %s\n", [(NSString *)s cString]);
  }

I'm getting an access exception on CFURLGetString(). appURL is not NULL.

Cheers,
Steve
OSX freeware and shareware: http://www.dekorte.com/downloads.html


Related mailsAuthorDate
mlDefault Web Browser Steve Dekorte Jan 26, 21:28
mlRe: Default Web Browser Vince DeMarco Jan 26, 22:11
mlRe: Default Web Browser Steve Dekorte Jan 26, 23:03
mlRe: Default Web Browser Steve Dekorte Jan 26, 23:39
mlRe: Default Web Browser Steve Dekorte Jan 27, 00:00
mlRe: Default Web Browser Nick Zitzmann Jan 27, 04:08
mlRe: Default Web Browser Vince DeMarco Jan 27, 08:26
mlRe: Default Web Browser Jérôme Seydoux Feb 3, 06:00