<div dir="ltr">On Linux you can use the alternatives to decide what browser to open.<br>On debian (I don't know about non debian based distro) you can use the sensible-browser command.<br>It points to the default web browser.<br>
<br>Ido<br><br clear="all"><a href="http://ik.homelinux.org/">http://ik.homelinux.org/</a><br>
<br><br><div class="gmail_quote">On Thu, Dec 4, 2008 at 12:54 AM, Bart <span dir="ltr"><<a href="mailto:bartjunk64@gmail.com">bartjunk64@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
I come from Windows/Delphi (3.0) background and I'm gradually moving<br>
towards Lazarus/fpc.<br>
<br>
Opening an URL in Windows is a piece of cake, you just let the OS take<br>
care of the assotiations with the http protocol to open it (using<br>
shellexecute).<br>
This of course will not do for other platforms.<br>
<br>
So I set myself the task of launching an URL in an external browser on<br>
other platforms.<br>
Since I only have Linux (besides Win) I began with that.<br>
<br>
I tried to find examples on the net, but had no luck.<br>
I might well be re-inventing the wheel though...<br>
<br>
Here's my approach:<br>
<br>
- try to detect the windowmanger (for now I know how to do this for<br>
KDE and GNOME, XFCE is on my whishlist)<br>
<br>
On KDE<br>
- lookup DESKTOK_LAUNCH environment variable<br>
- if not there, look for kde-open<br>
- if not there look for kfmclient<br>
- if not there look for xdg-open<br>
- if not there try fallback<br>
(possibly using gnome-open might also work under KDE ???)<br>
<br>
On GNOME<br>
- look fo gnome-open<br>
- if not there, look for xdg-open<br>
- if not there try fallback<br>
<br>
Fallback<br>
- search for know browsers (firefox, iceweasel, mozilla, opera,<br>
konqueror, ...(suggestions are welcome))<br>
<br>
If browser (or URL handler like kde-open, xdg-open etc.) is found<br>
launch it with the appropriate URL.<br>
<br>
This approach (the finding mechanism) seems to work at least on my<br>
Suse KDE desktop.<br>
<br>
I would like your opinions on this approach, and better still, I would<br>
like some suggestions how to achieve something similar on a Mac.<br>
(I suppose on Mac OSX the linux approach should work also???)<br>
<br>
And as a final rather dumb question: do all supported OS's have an<br>
environmentvariable PATH (as this is used in the fallback mechanism)?<br>
<font color="#888888"><br>
Bart<br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lazarus.freepascal.org">Lazarus@lazarus.freepascal.org</a><br>
<a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</font></blockquote></div><br></div>