Access API: Device IDs
Kiosk Pro allows you to reference the Unique iPad ID and any Group IDs set for your kiosk within Kiosk Pro through the following API functions and variables. Group IDs are only available in Plus and Enterprise versions of Kiosk Pro.
This lets you identify which kiosk is requesting a page or to tag form data with the ID of the sending kiosk. Checking for a Unique iPad ID and/or Groups ID if one is set can also provide a quick way of determining whether a visitor is accessing a site through Kiosk Pro (as opposed to a regular web browser).
Functions
App-Defined Variables
Callbacks
Related Settings
Requirements
To ensure that any app-defined variable is available when the ‘onload’ event is triggered, we recommend accessing the API 'By Import'. If you must access the API by injection, you will need to use Access: API Availability calls to determine when this type of variable is available.
- Access JavaScript API
- By Import - works both online & offline, requires inclusion of kiosk_functions.js prior to any of the following calls.
- By Injection - only works offline, may not be available 'onload'.
- App Settings
- Identifiers (either a Unique iPad ID or one or more Group IDs) must be set in Kiosk Pro settings for this API to work.
Sample Code
kp_requestKioskId
This function triggers a callback containing the Unique iPad ID set in Kiosk Pro settings.
Format | kp_requestKioskId(callback); |
Parameters | callback = callback name as string |
Callback format | callback(kioskId); |
Callback return values | kioskId = a string containing the Unique iPad ID. |
Example
This example requests the Unique iPad ID. It then uses the callback defined in the 'kp_requestKioskId_callback' call to insert the Unique iPad ID into the HTML page.
function updatePage() { kp_requestKioskId("kp_requestKioskId_callback"); } function kp_requestKioskId_callback(kioskId) { document.getElementById("kioskIdValue").innerHTML = "Unique iPad ID: \"<i><u>" + kioskId + "</u></i>\""; }
kp_Identification_getGroupIDs
This function triggers a callback returning any Group IDs set for that device in Kiosk Pro settings.
Format | kp_Identification_getGroupIDs(); |
Status
Triggers kp_Identification_groupsIDsDidChange, which returns any Group IDs assigned to that device as an associative array.
window.kioskpro_id
This variable defines the Unique iPad ID and can be used when accessing the JavaScript API by injection. Injected JavaScript variables and functions may not be available when the onLoad event is triggered and so you should use the callback 'kp_Vars_DidInject()' that is triggered by the app when injected variables are available to initiate this process as shown in the example belpw.
Format | window.kioskpro_id |
Example
This example uses the app to trigger the kp_Vars_DidInject function when it is available, and then returns the Unique iPad ID to insert into the page using window.kioskpro_id.toString().
function kp_Vars_DidInject() { updatePage(); } function updatePage() { document.getElementById("kioskIdValue").innerHTML = "Unique iPad ID: \"<i><u>" + getKioskId() + "</u></i>\""; } function getKioskId() { try { return window.kioskpro_id.toString(); } catch(e) { return ""; } }
kp_Identification_groupsIDsDidChange
This callback returns any Group ID's set for the device in Kiosk Pro settings as an associative array.
Format | kp_Identification_groupsIDsDidChange(groupIDs); |
Return Values | groupIDs = an associative array containing Group IDs as key-value pairs. |