Opening the default browser

I have a program that I’m working on that needs to
open a web-page in the “default” browser. As there is
no standard convention for having a defualt browser in
Unix the only thing I could think of is something
like:

#ifdef WIN32
return JustExecWebPage()
#else
#ifdef unix
if( IsDisplayEnvVarSet())
{
if( KdeIsRunning())
{
return AskKdeWhatTheDefaultBrowserIs();
}
else if( GnomeIsRunning())
{
return AskGnomeWhatTheDefaultBrowserIs();
}
else if( CdeIsRunning())
{
return AskCdeWhatTheDefaultBrowserIs();
}
else if( IsMozillaInstalled())
{
return RunMozilla();
}
else if( IsNetscapeInstalled())
{
return RunNetscape();
}
else if( IsOperaInstalled())
{
return RunOpera();
}
else if( IsMosaicInstalled())
{
return RunMosaic();
}
}
if ( DoWeHaveATerminal() && IsLynxInstalled() )
{
return RunLynx();
}
/* Give up! */
return NULL;
#else
#error “Add support for this platform”
#endif
#endif

While this may work, it seems un-necessarily
complicated. Anyone have any better ideas???

Thanks in advance,

-Loren__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

I’m not quite sure.

Im thinking of something like this:

exec("./readme.html");

exec is a system function, you have to choose the proper system function yourself.
The OS (GUI) has to take care which browser will be opened.

Lion Vollnhals______________________________________________________________________________
ich.bin at single.ms - nur eine der witzigsten E-Mail-Adressen der Welt!
Interesse? Klicken! http://digitaledienste.web.de/MyAdress/?mc=021105

— schiggl at web.de wrote:

I’m not quite sure.

Im thinking of something like this:

exec("./readme.html");

exec is a system function, you have to choose the
proper system function yourself.
The OS (GUI) has to take care which browser will be
opened.

Lion Vollnhals

This is how it works in windows… that’s the
problem… Unix has no concept of a "Default"
browser… it’s just another program… File
assosiations, similarly are a Mac and Windows
concept… Unix actually tries to run the web-page as
a program if you try that…

-Loren__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com

You can’t just exec a data file.On Sun, Aug 11, 2002 at 07:58:23PM +0200, schiggl at web.de wrote:

exec("./readme.html");

exec is a system function, you have to choose the proper system function yourself.
The OS (GUI) has to take care which browser will be opened.


Matthew Miller @Matthew_Miller http://www.mattdm.org/
Boston University Linux ------> http://linux.bu.edu/

I’ve always wondered why noone bothered using an env. variable to check
for preferred browser, much like email clients open your favorite editor
based on the $EDITOR env. var.

:^{

-bill!On Sun, Aug 11, 2002 at 11:04:56AM -0700, Loren Osborn wrote:

This is how it works in windows… that’s the
problem… Unix has no concept of a "Default"
browser… it’s just another program…

http://www.tuxedo.org/~esr/BROWSER/

It’s been tried, but hasn’t yeilded many results yet.On Sun, Aug 11, 2002 at 01:36:31PM -0700, nbs wrote:

This is how it works in windows… that’s the
problem… Unix has no concept of a "Default"
browser… it’s just another program…

I’ve always wondered why noone bothered using an env. variable to check
for preferred browser, much like email clients open your favorite editor
based on the $EDITOR env. var.


Joseph Carter Here we go again

Klingon function calls do not have ‘parameters’ – they have ‘arguments’
– and they ALWAYS WIN THEM.

-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 273 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20020811/df60c0f0/attachment.pgp

Well you can but try :

http://www.tuxedo.org/~esr/BROWSER/On Sunday 11 August 2002 21:36, nbs wrote:

On Sun, Aug 11, 2002 at 11:04:56AM -0700, Loren Osborn wrote:

This is how it works in windows… that’s the
problem… Unix has no concept of a "Default"
browser… it’s just another program…

I’ve always wondered why noone bothered using an env. variable to check
for preferred browser, much like email clients open your favorite editor
based on the $EDITOR env. var.


Matthew > http://www.soup-kitchen.net/
> ICQ 19482073

While this may work, it seems un-necessarily
complicated. Anyone have any better ideas???

That’s the extent of it. Remember to have an environment variable so users
can spawn a browser you’ve never heard of, and remember that no matter
what order you favor browsers in, someone will be pissed that you spawned
Mozilla and not Opera, or Opera and not Netscape 4.7, or Lynx and not
Links.

–ryan.