Page 1 of 1

Invoking the default browser in Linux.

Posted: Fri Sep 06, 2013 3:32 pm
by heartbone
I see this subject has been visited before for Windows and OSX:
[Windows] GetDefaultBrowser() http://www.purebasic.fr/english/viewtop ... 12&t=40093
[OSX] Launch a webpage? http://www.purebasic.fr/english/viewtop ... 19&t=52282

Now it's [Linux]'s turn.
Based on searching this forum, the best ways that I know of to start the browser to access a specific web follows.
Windows: RunProgram("http://www.purebasic.com/")
RunProgram("rundll32.exe","url.dll,FileProtocolHandler "+#DQUOTE$+"http://google.com"+#DQUOTE$,"")
ShellExecute_(0,"open","http://www.google.com","","",1)

OSX: RunProgram("open","http://www.purebasic.com/","")

The man page for Firefox leads me to this solution.
Linux: RunProgram("/usr/lib/firefox/firefox","-new-window http://www.purebasic.com/","")

The PureBasic command shown above works fine for my UBUNTU installation,
but I doubt if that path or browser is default for every Linux user.
I have used ExamineEnvironmentVariables() and I did not see any mention of browser there.

Does anyone know a way to invoke the default browser from PureBasic in Linux?

Re: Invoking the default browser in Linux.

Posted: Fri Sep 06, 2013 5:27 pm
by Totusoft
I use

RunProgram("xdg-open","http://www.purebasic.com","")

-Pete

Re: Invoking the default browser in Linux.

Posted: Fri Sep 06, 2013 6:39 pm
by heartbone
Totusoft wrote:I use

RunProgram("xdg-open","http://www.purebasic.com","")

-Pete
It works like a charm.
I thank you very much kind sir. :D