如何检查Chrome开发工具是否已打开? [英] How to check if Chrome Dev Tools are opened?
问题描述
我在codeschool.com上的教程中发现(discover-devtools: http: //discover-devtools.codeschool.com/chapters/1/challenges/3 )有可能检查Chrome开发者工具是否开放?如何检查它的状态/获得(cmd + alt + i)事件?
google是你的朋友在这里
p> 函数isInspectOpen()
{
console.profile();
console.profileEnd();
if(console.clear)console.clear();
返回console.profiles.length> 0;
}
from 这个问题
这个函数返回true就是用户拥有开发者工具打开
$ b 编辑
回应您的评论
$('#header')。click(alert(isInspectOpen()))
格式不正确jQUery,请尝试:
$('点击(function(){
alert(isInspectOpen());
});
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?
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());
});
这篇关于如何检查Chrome开发工具是否已打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!