Detect if DevTools is open and its orientation
Clone or download
Latest commit 34f148a Jun 23, 2017
Failed to load latest commit information.
.editorconfig Meta tweaks Dec 18, 2016
.gitattributes Meta tweaks Dec 18, 2016
.gitignore add XO Oct 21, 2015
index.html fix mixed content warning Nov 13, 2015
index.js Fix bug where zooming causes false positive. (#27) Dec 18, 2016
license tweaks Aug 22, 2014
package.json 2.2.0 Dec 18, 2016 Mention Opera Jun 23, 2017


Detect if DevTools is open and its orientation

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



$ npm install --save devtools-detect


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

	// get notified when it's opened/closed or orientation changes
	window.addEventListener('devtoolschange', function (e) {
		console.log('is DevTools open?',;
		console.log('and DevTools orientation?', e.detail.orientation);


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


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


MIT © Sindre Sorhus