Find Out Whether Chrome Console Is Open

Find out whether Chrome console is open

requestAnimationFrame (Late 2019)

Leaving these previous answers here for historical context. Currently Muhammad Umer's approach works on Chrome 78, with the added advantage of detecting both close and open events.

function toString (2019)

Credit to Overcl9ck's comment on this answer. Replacing the regex /./ with an empty function object still works.

var devtools = function() {};
devtools.toString = function() {
if (!this.opened) {
alert("Opened");
}
this.opened = true;
}

console.log('%c', devtools);
// devtools.opened will become true if/when the console is opened

How to check if Chrome Dev Tools are opened?

google is your friend here

function isInspectOpen()
{
console.profile();
console.profileEnd();
if (console.clear) console.clear();
return console.profiles.length > 0;
}

from This Question

this function will return true is the user has the developer tools open

edit

in response to your comment

$('#header').click(alert(isInspectOpen()))

is not properly formatted jQUery , try:

$('#header').click(function(){
alert(isInspectOpen());
});

Is there a way to open chrome devtools and ensure that console tab is selected

Yes, you can use command + option + j to always open the Console!
https://developer.chrome.com/docs/devtools/open/#console

Sample Image

Is there a way to make chrome devtools undetectable?

In Chrome 73+ it's possible to open devtools before the page can run any code to detect it:

  1. open chrome://inspect
  2. click "Pages"
  3. click "pause" on an entry for the tab you want to debug

Now you can inspect the page, find out how exactly it detects devtools, and defuse it. Judging by the code in your question, you can run window.uomg.create.onchange = null, but if not, set breakpoints in the code and debug it to find out a working method.



Related Topics



Leave a reply



Submit