Skip navigation.
 
mlRe: Default Web Browser
FROM : Vince DeMarco
DATE : Mon Jan 27 08:26:05 2003

use

char *URL = "http://www.apple.com"

you should get the default browser that way.

you are asking it what file you want to open a .html file with which is 
different from what program you want to use to open web sites.


vince

On Sunday, January 26, 2003, at 11:35  PM, Steve Dekorte wrote:

>
> On Sunday, January 26, 2003, at 10:59 PM, Steve Dekorte wrote:

>> 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?:

>
> Found the problem - the file has to be present. This works:
>
>  {
>    char *URL = 
> "file:///System/Library/Frameworks/AppKit.framework/Versions/C/
> Resources/English.lproj/Documentation/Reference/ObjC_classic/
> AppKitTOC.html";
>    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("default web browser = %s\n", [[(NSString *)s 
> lastPathComponent] cString]);
>  }
>
> Cheers,
> Steve
> OSX freeware and shareware: http://www.dekorte.com/downloads.html
>
> _______________________________________________
> MacOSX-dev mailing list
> <email_removed>
> http://www.omnigroup.com/mailman/listinfo/macosx-dev



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