Returns "locked" if the system is locked, "idle" if the user has not generated any input for a specified number of seconds, or "active" otherwise.

This is an asynchronous function that returns a Promise.


var querying = browser.idle.queryState(
  detectionIntervalInSeconds // integer


integer. The system is considered idle if detectionIntervalInSeconds seconds have elapsed since the last user input detected.

Return value

A Promise that will be fulfilled with an idle.IdleState string, indicating the current state.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxOperaFirefox for Android
queryStateChrome Full support YesEdge Full support 15Firefox Full support 45
Full support 45
Notes Before version 51, Firefox always reports 'active'. After version 51, Firefox reports 'active' or 'idle' as appropriate.
Opera Full support YesFirefox Android Full support 48
Full support 48
Notes Before version 51, Firefox always reports 'active'. After version 51, Firefox reports 'active' or 'idle' as appropriate.
lockedChrome Full support YesEdge No support NoFirefox No support NoOpera Full support YesFirefox Android No support No


Full support  
Full support
No support  
No support
See implementation notes.
See implementation notes.


In this simple snippet, we call queryState() and then check if the returned newState is idle or active, logging a message as appropriate. Because we have specified  a detectionIntervalInSeconds of 15, an idle state will only be reported if there has been no user activity for at least 15 seconds

function onGot(newState) {
  if (newState === 'idle') {
    console.log('Please come back — we miss you!');
  } else if (newState === 'active') {
    console.log('Glad to still have you with us!');

var querying = browser.idle.queryState(15);

This API is based on Chromium's chrome.idle API. This documentation is derived from idle.json in the Chromium code.

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

Contributors to this page: mdnwebdocs-bot, wbamberg, Makyen, chrisdavidmills, kmaglione
Last updated by: mdnwebdocs-bot,