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
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:
- open
chrome://inspect
- click "Pages"
- 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
Check Whether Variable Is Number or String in JavaScript
How to Detect If Browser Window Is Scrolled to Bottom
How to Upload a File with the Js Fetch API
Passing an Array as a Function Parameter in JavaScript
"Innerhtml += ..." VS "Appendchild(Txtnode)"
How to Send JSON Instead of a Query String with $.Ajax
Are Trailing Commas in Arrays and Objects Part of the Spec
Why Variable Hoisting After Return Works on Some Browsers, and Some Not
Format Numbers in JavaScript Similar to C#
I Know That Callback Function Runs Asynchronously, But Why
What Is Typescript and Why Would I Use It in Place of JavaScript
Programmatically Lighten or Darken a Hex Color (Or Rgb, and Blend Colors)
Filter Object Properties by Key in Es6
Strip All Non-Numeric Characters from String in JavaScript
React - Uncaught Typeerror: Cannot Read Property 'Setstate' of Undefined
Accessing Jpeg Exif Rotation Data in JavaScript on the Client Side