API: Pause or Trigger Idle Timer
Allows you to pause the Idle Time Limit (for example, while a visitor is watching a video and would not be expected to interact with the screen) and also to trigger the Idle Time Limit manually at any time.
In this article
Requirements
Requirements
- Integration of our JavaScript API into your webpage
- Sample code to run within the app and download for integration into your own project is available here.
- Best practices for working with the JavaScript API are available here.
- App Settings
- Content > JavaScript API > Access JavaScript API = By Import
- if pausing the Idle Timer, Content Refresh > Idle Time Limit = a value greater than zero
Triggers via API Functions
Pause Idle Timer
This callback is triggered by Kiosk Pro every time the idle timer is fired and determines whether it should be executed. If you want the idle timer to skip, this method must return 'yes'. Any other value will allow execution of the idle timer & return to the Homepage.
If a native JavaScript alert, prompt, or confirmation dialog is being shown when the idle timer fires, Kiosk Pro is unable to evaluate the result of this callback. In that instance, the idle timer will execute regardless of what this callback is set to return.
Format | KioskShouldDisableIdleTimer(); |
Example | function KioskShouldDisableIdleTimer() { var shouldSkipAction = "NO"; if (condition) { shouldSkipAction = "YES"; } return shouldSkipAction; } |
While the function above will prevent the idle timer from firing and refreshing to the homepage, there are other timers that will continue to run that can also cause this type of refresh. See Refresh Homepage and Other Triggers for Content Refresh for more information.
Trigger Idle Timer
This function immediately triggers the idle timer, returning the visitor to the homepage, clearing navigation history, ending the visitor session (if using the Remote Management server), and clearing cache, cookies, or local storage (if these are configured in Kiosk Pro's settings).
Format | kp_IdleTimer_fire(); |
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 kioskgroup.com/idle-timer-api
- To download a .zip of sample code, click here.
Change Log
- Ability to pause idle timer included in version 1.0. Ability to trigger idle timer added to Plus and Enterprise in version 3.1 and Basic in version 9.0.2.