<p>I have an application that launches a webpage in the "current" browser when the user selects it. This part of my app works fine in the Windows version but I can't figure out how to do this in Linux build.</p>

<p>Right now the Linux version is hardcoded for Firefox in a specific directory and runs a new instance of it each time and doesn't show the URL that I pass in. I would like it to NOT launch a new version each time but just open a new page in the current open one if it is already running. </p>

<p>For windows I use:</p>

<pre><code>ShellExecute(NULL,"open",filename,NULL,NULL,SW_SHOWNORMAL);
</code></pre>

<p>For Linux I currently use:</p>

<pre><code>pid_t pid;
char *args[2];

char *prog=0;
char firefox[]={"/usr/bin/firefox"};

if(strstri(filename,".html"))
    prog=firefox;

if(prog)
{
    args[0]=(char *)filename;
    args[1]=0;
    pid=fork();
    if(!pid)
        execvp(prog,args);

}
</code></pre>

If you're writing this for modern distros, you can use
```
xdg-open
```
:
```
```
$ xdg-open http://google.com/
```
```
If you're on an older version you'll have to use a desktop-specific command like
```
gnome-open
```
or
```
exo-open
```
.