How to Detect User Inactivity Using Javascript | Idle Tracker


Javascript library to track browser inactivity – callback when the user is idle. A small idle tracking library that tracks user interactions on the webpage and activates reconnection if the user becomes idle.

how to detect user inactivity in windows, how to detect user inactivity in browser, how to detect idle time in javascript, react idle timer, javascript idle timeout redirect

Default events the library listens for:

  • change
  • keydown
  • mousedown
  • mousemove
  • mouseup
  • orientationchange
  • resize
  • scroll
  • touchend
  • touchmove
  • touchstart
  • visibilitychange

How to make use of it:

Install the library with package deal managers.

# Yarn
$ yarn add idle-tracker

$ npm install idle-tracker --save

Import the idle-tracker.

import IdleTracker from 'idle-tracker';

Load the umd version of the idle-tracker within the doc.

<script src="dist/index.js"></script>
<script src="dist/active-events.js"></script>

Create a new Idle Tracker and specify the timeout, callback function, and lively events.

var idelTracker = new Tracker({
    timeout: 3000,
    onIdleCallback: idleFunction,
    throttle: 500
    events: activeEvents.default

Start the idle tracker and completed it.


Idle Tracker Github, Detecting If the User is Idle or Inactive, javascript detect if user is active

See Demo And Download

Official Website(roderickhsiao): Click Here

This superior jQuery/javascript plugin is developed by roderickhsiao. For extra Advanced usage, please go to the official website.