Skip to main content

Detect Here™ Core support from a web browser

Many apps are written specifically to run in the Here Core Runtime. When a user loads your site in their web browser you have always had the option of presenting them with a fins link to launch your application. What you haven't had is the ability to detect whether you should present them with a fins link or an installer if they do not have Here Core on their machine.

This detection ability is now available through a script you can add to your website.

Detecting Here Core is a two step process:

  1. Detect the fins protocol. This is possible only if allowed in desktop owner settings.
  2. Detect whether the user can access the Here™ resources.

Detect the fins protocol

The checkForFinsProtocol() function returns an object that reveals whether the fins protocol is supported on the desktop. If the isFinsDetectionSupported and isFinsSupported properties are both true, then the fins protocol is available.

How you call the function depends on whether you invoke a <script> element in HTML, or work with an installed NPM package.

With the npm module:

import { checkForFinsProtocol } from '@openfin/deployment';
//...
const finsProtocolResult = await checkForFinsProtocol();
if (finsProtocolResult.isFinsDetectionSupported && finsProtocol.isFinsSupported){
// fins protocol is supported
}
//...

In an HTML script element:

<script src="https://cdn.openfin.co/tools/deployment/1.0.0/openfin-deployment.js"></script>
<script>
const finsProtocolResult = await openfinDeployment.checkForFinsProtocol();
if (finsProtocolResult.isFinsDetectionSupported && finsProtocol.isFinsSupported){
// fins protocol is supported
}
//Anything else you want to do
</script>

Access Here™ resources

The checkEndpoints() function can be called to check whether the desktop can access Here™ resources, such as the Here™ CDN, or any custom endpoints. The function returns an array of Endpoint objects. If the status property of the Endpoint object is true, the resource is available.

import { checkEndpoints, Endpoint, EndpointStatus, OpenFinEndpoint } from '@openfin/deployment';

const endpointResults = await checkEndpoints();
customResult.forEach((status) => {
console.log(status.url, status.success);
});

// Check all Here Core endpoints, excluding OpenFinEndpoint.Diagnostics.
const endpointCheckResult = await checkEndpoints([OpenFinEndpoint.Diagnostics]);

// Check additional custom endpoints.
const customEndpoints:Endpoint[] = [
{
id: 'Here™ Website',
url: 'https://here.io',
displayName: 'Here™ Website'
}
];

const customResult = await checkEndpoints([], customEndpoints);

Enable in desktop owner settings

In RVM v11 and earlier releases, to enable the checkForFinsProtocol function, the following setting needs to be added to the Desktop Owner Settings file.

  "desktopSettings": {
//other settings ...
"enableInstallationDetection":true,
//other settings ...
}

In RVM v12 and later, enableInstallationDetection is true by default, so you do not need to define it. You can set it to false to prevent applications from detecting whether Here Core is already installed.

Samples

Two code samples are available in the @built-on-openfin/deployment repository that demonstrate how to detect the fins protocol and detect access to Here™ resources.