Access JavaScript API

Supported In:

Kiosk Pro Basic, Plus and Enterprise

Choose how Kiosk Pro should access the JavaScript API functions.

Default Value for Basic & Plus:
  • Never
Default Value for Enterprise:
  • By Import
Other Possible Values:
  • By Injection (Deprecated, Offline Only)

By Import

Accessing the API by import allows the ability to import the hooks through an external JavaScript file, 'kiosk_functions.js', that you reference in your page.

This method has the advantage of ensuring that all functions are loaded and available when the window.onload event is triggered, which increases reliability and simplify coding of functions. This also allows you to only include these functions on pages where they are being used, which decreases loading time of other pages.

To use this method, you will need to include the 'kiosk_functions.js' file, referencing it as an external script in each page prior to any other external .js files or scripts that rely on these functions. To generate the latest version of 'kiosk_functions.js' compatible with the version of the app you are currently running, use the Generate API Functions File setting.

Never

This option disables the JavaScript API. None of the custom functions will be loaded or available to your pages at any time. This option may increase page loading speed so if you are not using the API, it's the best choice.

By Injection (Deprecated, Offline Only)

Accessing the JavaScript API by injection allows the app to automatically load API functions into each page as it is run. Due to Apple's rules around security and the use of JavaScript, these functions are only enabled by the app if the device is offline.

This is also the only option if you do not have direct access to add the 'kiosk_functions.js' file to each page and need access to these functions.

As our injection model is not able to provide the ability to inject hooks instantaneously into the current HTML-page, there may be a delay between window.onload trigger and the availability of these JavaScript functions. To find out exactly when the hooks are available, you have two options:

  • Listen for JavaScript callback: kp_Hooks_DidInject(). This will be called when all hooks finish injecting.
  • Check global JavaScript variable: kioskpro_hooks_available. If this variable is defined and equal to 1, then hooks are available.

Our Availability API checks if the API is available before trying to call other API functions. Documentation is available here.

Values for Remote Settings Control & Managed App Configuration

Key accessJS_API
Key Type integer
Default Values
  • 2 (Basic & Plus)
  • 1 (Enterprise)
Possible Values
  • 1 = By Import
  • 2 = Never
  • 0 = By Injection (Deprecated, Offline Only)

Change Log

Included in version 3.4.  The option to access the API by injection was deprecated in version 10.0

Related Articles

Still stuck? How can we help? How can we help?