How to check if Chrome Dev tools are open?

I found in the tutorial on codchool.com (find-devtools: http://discover-devtools.codeschool.com/chapters/1/challenges/3 ) that it is possible to check if the tools for creating chrome are open? How to check status / get event (cmd + alt + i) pressed?

+3
source share
2 answers

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, the user opens the developer tools

change

in response to your comment

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

jquery formatted incorrectly, try:

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

Source: https://habr.com/ru/post/1612273/


All Articles