Regarding the answer of mjn, I have written the following unit. I have successfully tested it on Windows but I don't have an OSX to test it on this platform. If someone can confirm it works, I'd appreciate.
unit fOpen;
interface
uses
{$IFDEF MSWINDOWS}
Winapi.ShellAPI, Winapi.Windows;
{$ENDIF MSWINDOWS}
{$IFDEF POSIX}
Posix.Stdlib;
{$ENDIF POSIX}
type
TMisc = class
class procedure Open(sCommand: string);
end;
implementation
class procedure TMisc.Open(sCommand: string);
begin
{$IFDEF MSWINDOWS}
ShellExecute(0, 'OPEN', PChar(sCommand), '', '', SW_SHOWNORMAL);
{$ENDIF MSWINDOWS}
{$IFDEF POSIX}
_system(PAnsiChar('open ' + AnsiString(sCommand)));
{$ENDIF POSIX}
end;
end.
and I call it like this:
TMisc.Open('https://stackoverflow.com/questions/7443264/how-to-open-an-url-with-the-default-browser-with-firemonkey-cross-platform-applic');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…