Launch executable on local machine

Is it possible to launch an executable on the local machine from a WEB Core application (not Electron or Miletus), something along the line of ShellExecute?

If your WEB Core application is running in a typical browser, then this is likely not possible as the browser will deliberately "sandbox" your application. One of the reasons it does this is to specifically prevent web applications from doing exactly this kind of thing, as it is a tremendous security risk.

There are ways around this in certain settings, particularly if you're the developer of the app that you want to launch. What is it that you're trying to do, exactly?

Hi Andrew,
Thanks for your response. We are in process of developing a website with WEB Core for traders and part of it is to provide access to live charts hosted on TradingView.com for registered users. TradingView does not allow for embedding the link within our webpage through the TWebBrowser component ( Refused to display '' in a frame because it set 'X-Frame-Options' to 'deny'). Sure, I can provide the weblink that will launch your default browser, but then it is easy to distribute those links to anyone (we would have had the same problem with the embedded charts as the developer console of the browser would also reveal the links).
I created a standalone FMX application that makes use of TTMSFNCWebCoreClientBrowser that has no problem in displaying the live charts and the web link is not readily available taking this approach. This brings me to the question on how do I launch that application from the webpage.
Regards,
Rainier

If I'm following you correctly, then, you've developed an FMX app (a traditional executable running on Win/Mac/Linux?) that you want to launch when someone, say, clicks a button in your WEB Core app?

Do they already have the FMX app installed locally? If so, one idea is to setup the FMX app so that it is always running (or setup a separate "service" type app, something that might live in the taskbar for example). This could then wait for a message from the WEB Core app that it is to "wake up" the FMX app (or just display the main form if it is the same app) and then present whatever link is passed from the WEB Core app (like a URL for example).

To pass the URL, there are a few options. If you've got something like an external XData server or other REST API server, you could have the WEB Core app post a URL to the user's account there, and have the FMX app poll it periodically to check for that URL. While polling may sound less than ideal, you can adjust the polling frequency based on various events.

Or you could use the just announced FNC WebSockets product to connect the FMX app and the WEB Core app so they can communicate more directly.

The trick is having the FMX app already running.

If casual users are using your WEB Core app and don't have the FMX app already installed, the best you can likely do is offer the download to them and hope they install it. This means generally that your app has to be presented as trustworthy (signed or whatever your platform of choice requires) unless you have a more direct relationship with your users.

I have a XData Server running and the idea was that registered users would have to download the application to get that specific functionality, but I did not consider having it run all the time - excellent idea!
Thanks for the advice, much appreciated!

Also, I imagine that one of the main reasons you're wanting to do this is to take advantage of the charts that have been created by the TradingView folks. Seems they've put some work into them! However, their platform (and others of course - I've tinkered a bit with IEX Cloud for example) support accessing the data that is used to create the charts.

If you're looking to develop a more fully-featured WEB Core trading-style app, this might be a good approach longer-term. Depending on what you're after, it should be possible to create similar charts. I think they even offer their charting library for you to use. Something that could probably be integrated pretty easily into a WEB Core app.

There are more than a few posts on the TMS blog about charting and WEB Core, using either FNC Charts or other JS charting libraries. I wrote a few of these regarding D3 Charts, but the approach is likely to be the same regardless of the charting library. So it might be that you can get the data from a TradingView API and display it using one of their charting libraries, and not even need the FMX side of things.

Will look into it - the main feature we are after is to show live the technical analysis done by a group of specific users. I agree there might be better options and I guess we will come across them as we delve deeper.

In addition, if you developed an FMX app that integrates a browser from where you run the web app, you can communicate between the web app and the hosting native FMX application using the FNC browser bridge.
It is explained here:

1 Like

Using the bridge approach sounds a bit like creating your own browser just for your specific WEB Core app (though not restricted to that) where you aren't as constrained by the usual browser sandboxing. Kind of a simpler version of what Miletus and Electron do.

Good to have so many options!