How to check if Chrome Dev Tools are opened? [duplicate]

…衆ロ難τιáo~ 提交于 2019-11-30 23:13:10
Scott Selby

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());
});

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!