Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Detect if DevTools is open
branch: gh-pages
Failed to load latest commit information.
.editorconfig tweaks
.gitattributes init
.jshintrc tweaks
bower.json 0.1.2
devtools-detect.js add to package-managers
index.html init
license tweaks
package.json 1.0.0
readme.md tweaks

readme.md

devtools-detect

Detect if DevTools is open

Useful for when you want something special to happen when DevTools is open. Like pausing canvas, adding style debug info, etc.

Demo

Install

$ npm install --save devtools-detect

(with Browserify)

$ bower install --save devtools-detect

Usage

<script src="devtools-detect.js"></script>
<script>
    // check if it's open
    console.log('is DevTools open?', window.devtools.open);

    // get notified when it's opened/closed
    window.addEventListener('devtoolschange', function (e) {
        console.log('is DevTools open?', e.detail.open);
    });
</script>

Support

  • Chrome DevTools
  • Safari DevTools
  • Firefox DevTools
  • Firebug
  • Firebug Lite

Caveats

Doesn't work if DevTools is undocked and will show false positive if you toggle any kind of sidebar.

License

MIT © Sindre Sorhus

Something went wrong with that request. Please try again.