FS#2750 - function to open an URL in web browser from OpenTTD

Attached to Project: OpenTTD
Opened by Leif Linse (Zuu) - Saturday, 21 March 2009, 10:33 GMT
Last edited by Thijs Marinussen (Yexo) - Sunday, 11 December 2011, 11:48 GMT
Type Feature Request
Category Core
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No


The idea is that in OpenTTD there exist situations where you would like to make OpenTTD open a specific URL in the users web browser.

This is known to be different on different platforms, so therefore I have tried to figure out how to do it on Windows, Linux and MacOSX. To keep track of the result I've decided to open this ticket and have it written down here.

The ShellExecute function is used to Open an URL. So you simply pass the open-argument and the URL. I don't think it is necessary to write down exactly how to do it here, as google has tons of results concerning how to open an URL in Windows.

On MacOSX there is an utility in PATH called 'open' that can be used to open URLs like this:

On Linux there is no *default browser* property that is safe over all various distributions and desktop environment. But there is an intiative to provide developers with a tool to bridge this that eis_os told about:

I have not tested XdgUtils, so I don't know how safe it is, but we might need to fallback on having a configurable setting in OpenTTD which would simply be a string containing the path to the web browser as well as any needed arguments before the URL is added. (The problem here is that OpenTTD don't have strings as a configuration type yet, so that need to be sorted out I guess.)
This task depends upon

Closed by  Thijs Marinussen (Yexo)
Sunday, 11 December 2011, 11:48 GMT
Reason for closing:  Implemented
Additional comments about closing:  In r23490