1

I'm debugging my code in Chrome with Dev Tools.

I wonder if I can have JS loaded only when DevTools active in Chrome, and ignored otherwise. So that I could ship my code with debugging logic in production, without affecting application performance, for general users.

Something like

<!-- if dev tools working load /debuf.js-->
mavarazy
  • 7,562
  • 1
  • 34
  • 60
  • possible duplicate of [Find out whether Chrome console is open](http://stackoverflow.com/questions/7798748/find-out-whether-chrome-console-is-open) – lifeisfoo Sep 12 '15 at 18:09

1 Answers1

2

You can use the devtools-detect library: https://github.com/sindresorhus/devtools-detect

It can detect if the DevTools are active, but it is not 100% correct

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

Pinguin895
  • 999
  • 2
  • 11
  • 28