How to open url in external browser?

dear community,
does someone knows how to open an url from within my game / c code
in an external browser? i know how to do it in win32:

#ifdef LINUX
// todo
#endif

#ifdef _WIN32
#include <shellapi.h>
void open_url(const string& url)
{
ShellExecute(GetActiveWindow(),
“open”, url.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
#endif

but someone knows how to do under linux and probably for mac os ?

thanks in advance!!

I’d take a look at the code in wxWidgets for this. They’ve got a
pretty robust implementation. I think it’s pretty separable too.On 5/25/06, Andre Krause wrote:

dear community,
does someone knows how to open an url from within my game / c code
in an external browser? i know how to do it in win32:

#ifdef LINUX
// todo
#endif

#ifdef _WIN32
#include <shellapi.h>
void open_url(const string& url)
{
ShellExecute(GetActiveWindow(),
“open”, url.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
#endif

dear community,
does someone knows how to open an url from within my game / c code
in an external browser? i know how to do it in win32:

#ifdef LINUX
// todo
#endif

#ifdef _WIN32
#include <shellapi.h>
void open_url(const string& url)
{
ShellExecute(GetActiveWindow(),
“open”, url.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
#endif

but someone knows how to do under linux and probably for mac os ?

For Mac OS X:
[[NSWorkspace sharedWorkspace] openURL:[NSURL
URLWithString:@“http://www.libsdl.org”]];

-Eric> From: Andre Krause

Le 26 mai 06 ? 02:58, E. Wing a ?crit :

For Mac OS X:
[[NSWorkspace sharedWorkspace] openURL:[NSURL
URLWithString:@“http://www.libsdl.org”]];

or, if you prefer a C interface, use launch services [1] as follows :

#include <ApplicationServices/ApplicationServices.h>

void open_url (const char *link)
{
CFURLRef url = CFURLCreateWithBytes (NULL, (UInt8 *)link, strlen
(link),
kCFStringEncodingASCII, NULL);
LSOpenCFURLRef (url, NULL);
CFRelease (url);
}

Best,

Daniel

[1]
<http://developer.apple.com/documentation/Carbon/Conceptual/
LaunchServicesConcepts/index.html>
<http://developer.apple.com/documentation/Carbon/Reference/
LaunchServicesReference/index.html>

dear community,
does someone knows how to open an url from within my game / c code
in an external browser? i know how to do it in win32:

#ifdef LINUX
// todo
#endif

#ifdef _WIN32
#include <shellapi.h>
void open_url(const string& url)
{
ShellExecute(GetActiveWindow(),
“open”, url.c_str(), NULL, NULL, SW_SHOWNORMAL);
}
#endif

but someone knows how to do under linux and probably for mac os ?

Linux pseudo code:

system("mozilla " + url);

ChrisOn 5/25/06, E. Wing wrote:

From: Andre Krause


E-Mail: Chris Nystrom <@Chris_Nystrom>
http://www.newio.org/
AIM: nystromchris

Chris Nystrom wrote:

Linux pseudo code:

system("mozilla " + url);

That’s a joke, right?–
Christian
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20060527/ec0efc4b/attachment.pgp

Did I mis-read the question? I understood it was to open an external browser
window from a C program on linux. This works for me:On 5/26/06, Christian Biere wrote:

Chris Nystrom wrote:

Linux pseudo code:

system("mozilla " + url);

That’s a joke, right?


#include <stdlib.h>

int
main(void)
{
char command[] = “mozilla http://www.newio.org”;

    system(command);

    return(0);

}

Chris


E-Mail: Chris Nystrom <@Chris_Nystrom>
http://www.newio.org/
AIM: nystromchris

Did I mis-read the question? I understood it was to open an external
browser window from a C program on linux. This works for me:

Yes, if you want to run Mozilla. But others want Opera, Firefox,
Konqueror, uh…other things.

This is actually something sorely missing from Linux. The best we’ve got
right now is the BROWSER variable:

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

Which has worked well for UT200x, and other projects, usually with a
default string like this if not set:

“firefox:opera:mozilla:netscape”

(putting Konqueror in that list was too risky, since it might launch all
of KDE on an otherwise-Gnome desktop. End users can set this to
"BROWSER=‘kfmclient openURL’" if they like, though.)

Such a mess.

–ryan.

Wrong! ;^P (I don’t use Mozilla, I use Konqueror. If I did use the
Mozilla browser, it’s called “SeaMonkey” now[*]. And most other people
have switched to Firefox, anyway.)

What you probably want is covered here:

"Standards/mime-actions-spec"
http://www.freedesktop.org/wiki/Standards_2fmime_2dactions_2dspec

The freedesktop.org Shared MIME database provides a single way to store
static information about MIME types and rules for determining a type.

[*] I actually do use SeaMonkey at work, where I’m stuck on WinXP.On Fri, May 26, 2006 at 11:19:52PM -0500, Chris Nystrom wrote:

Linux pseudo code:

system("mozilla " + url);


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/