问题
I found in the tutorial on codeschool.com (discover-devtools: http://discover-devtools.codeschool.com/chapters/1/challenges/3) that there is possibility to check if chrome developer tools are open? How to check it's state/get event of (cmd+alt+i) pressed?
回答1:
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());
});
回答2:
You could try a logging framework like log4js or similar. http://log4js.berlios.de/links.html#other
Your code would have less dependency on a specific browser.
来源:https://stackoverflow.com/questions/16765287/how-to-check-if-chrome-dev-tools-are-opened