Access API: Location

The location coordinates of the device can be set as a JavaScript array by the app as your page is loaded. Once defined, the array contains key-value pairs for latitude, longitude, accuracy, and a timestamp of when the reading was taken.

If the app is set to Define Location Coordinates > Continuously, it will pull location data from the device once a minute and compares it to the previous location data. If a change in location is detected, Kiosk Pro supports a special callback to notify your page of that change.


App-Defined Variables

Related Settings


  • Access JavaScript API
    • By Import - recommended, 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' event.
  • Define Location Coordinates
    • On App Launch - for a stationary kiosk, defining these variables once when the app is launched may be sufficient and will help prevent battery drain from regular location monitoring.
    • Continuously - queries once a minute for new location data.
  • Permission to access Location Services
    • Location Services can be turned on in iOS Settings > Privacy > Location Services. Once this setting is enabled, a special system alert will pop-up immediately after launching the app asking for permission to access Location Services. You must grant this permission for the app to be able to access and return location data.

Sample Code

This sample code relies on the JavaScript APIs built into Kiosk Pro and will not run successfully in other browsers or within our in-app help interface.  
To run sample code, set the app's homepage to

Download Sample Code


This callback is triggered by the app when new location coordinates are detected. Since this detection is based on new location data, 'Define Location Coordinates' must be set to 'Continuously'.

Parameters callback = callback name as a string.


Returns no specific value, but can be used to trigger other events based on the location of the device changing. This is done by defining this callback function in your code and placing a call within it.

For example, this call is used in the Location API code sample referenced above to update the page with new coordinates when a change in location is detected.


This associative array returns key-value pairs defining the coordinates, accuracy, and timestamp of the most recent location check.

Return Values
  • latitude = the latitude in degrees. Positive values indicate latitudes north of the equator. Negative values indicate latitudes south of the equator.
  • longitude = the longitude in degrees. Measurements are relative to the zero meridian, with positive values extending east of the meridian and negative values extending west of the meridian.
  • accuracy = the radius of uncertainty for the location, measured in meters.
  • timestamp = the time at which this location check occurred.


To return an alert containing the timestamp of the last location check, you could call:

function alertLocationTimestamp() {
	var timestamp = window.kioskpro_location['timestamp'];

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