
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.
TMisc.Open('http://www.fmxexpress.com/');
Check out all of the answers about ShellExecute() on IOS and Android.
Update: Here is a version of TMisc that uses native API code to launch on Android and IOS. Download the combination of TMisc and native API code to launch URLs.
How can we do this in android?
Here is an updated version which includes native API calls for IOS and Android.
http://www.fmxexpress.com/wp-content/uploads/2014/01/OpenURLExample.zip