Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Is there a platform-independent way to open a URL in the default browser?


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Nov 27, 2017 10:40 AM Last Post By: Remy Lebeau (Te...
Don Rowe

Posts: 37
Registered: 7/1/11
Is there a platform-independent way to open a URL in the default browser?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 26, 2017 4:49 PM
I'm using Tokyo, firemonkey, and c++. Is there a platform-independent way to open a URL in the default browser? My immediate need is a button to take the user to the program's website.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Is there a platform-independent way to open a URL in the default browser?
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 27, 2017 10:40 AM   in response to: Don Rowe in response to: Don Rowe
Don Rowe wrote:

I'm using Tokyo, firemonkey, and c++. Is there a
platform-independent way to open a URL in the default browser?

No, there is not. You have to IFDEF your code to use platform-specific
APIs. See https://stackoverflow.com/a/33641439/65863.

On Windows, use ShellExecute/Ex().

On OSX, use ??? (I don't know).

On Android, create an ACTION_VIEW Intent containing the URL, and then
pass it to Activity.startActivity().

On iOS, use sharedApplication.openUrl().

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02