TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Chrome Inspector Detector

176 pointsby afschwartzabout 12 years ago
Detect whether the Chrome Inspector is open and docked, open and in a separate window, or closed.

27 comments

skoreabout 12 years ago
This ushers in a new era of annoying and pointless "This website prevents right clicks" popups.<p>Just the other day I said to my coworker everybody, by now, knew how to use firebug/inspector (he disagreed and, being in support, he does see more suffering than I do) - we were looking at a client site that had a <i>javascript obfuscation of the html source</i>.<p>It's like this grand battle stage of the worlds tiniest violins.
zackbloomabout 12 years ago
A developer could use this to kill all the DOM nodes on the page when the console was opened. This might be the next generation of:<p><pre><code> img.onclick="javascript:function(){alert('Don\'t steal!');return false}"</code></pre>
评论 #5431152 未加载
评论 #5431190 未加载
评论 #5432737 未加载
raldiabout 12 years ago
How do I press ⌘ on Linux?
评论 #5431047 未加载
评论 #5431048 未加载
评论 #5432623 未加载
评论 #5431102 未加载
jsonmezabout 12 years ago
Oh, the evil things I could do with this to coworkers who try to debug my Javascript code. Oh, the evil things I could do...
评论 #5431091 未加载
afschwartzabout 12 years ago
Thanks for reporting all of the issues.<p>I'll continue to improve and update <a href="https://github.com/adamschwartz/chrome-inspector-detector/issues" rel="nofollow">https://github.com/adamschwartz/chrome-inspector-detector/is...</a> with the issues reported here. Thanks.
etjossemabout 12 years ago
Could be an intriguing way to detect other developers visiting the site and communicate with them. Last time I checked, the front page of <a href="https://vimeo.com" rel="nofollow">https://vimeo.com</a> was using the inspector console as a recruiting tool.
评论 #5433101 未加载
DomreiRoamabout 12 years ago
It's a nice demo and congratulation to Adam but I wonder if I m the only one that doesn't like that the browser allows this detection. I mean accessing the log is one thing but shouldn't this be this unreachable fro; the sandbox?
just2nabout 12 years ago
Defeated:<p><pre><code> javascript:clearTimeout(setTimeout(function(){}, 1) - 1);</code></pre>
评论 #5431081 未加载
patejamabout 12 years ago
Doesn't work exclusively with the Chrome Inspector. Having the downloads bar at the bottom sets this off as well, for example.
评论 #5430931 未加载
评论 #5430933 未加载
twinnabout 12 years ago
This is cool, I used the same technique in the discover-devtools.codeschool.com course for the first challenge.
评论 #5431245 未加载
ryiytryeabout 12 years ago
Works fine to detect the inspection window, but a false positive (as "open and docked") if I change Chrome window state from maximised to normal.
评论 #5430980 未加载
theoutlanderabout 12 years ago
On Windows, use F12 instead of Ctrl + Shift + I
homakovabout 12 years ago
I was hoping it is doing kind of this detection <a href="http://homakov.blogspot.com/2013/03/pwning-your-privacy-in-all-browsers.html" rel="nofollow">http://homakov.blogspot.com/2013/03/pwning-your-privacy-in-a...</a><p>you simply used chrome api :)
FiloSottileabout 12 years ago
On Canary it continually spams this on the console:<p><pre><code> Profile 'Profile 13' started. chrome.inspector-detector.js:16 Profile 'Profile 13' finished. chrome.inspector-detector.js:17 Console was cleared</code></pre>
md224about 12 years ago
Apologies if this is a silly question, but why is console.clear() needed for this to work?<p>EDIT: Oh, I get it, it must be housekeeping to clear the log messages generated by the profiler.
评论 #5431084 未加载
hyshaiabout 12 years ago
Worst case scenario, to defeat this: Save page to local drive, edit JS (and remove this) in your IDE/text editor. Open locally.
评论 #5431297 未加载
评论 #5433044 未加载
devnielabout 12 years ago
Interesting, I thought that you played with the document and window height
tantalorabout 12 years ago
<p><pre><code> delete window.chrome.inspector </code></pre> Did I win?
vladikoffabout 12 years ago
Doesn't work even without the downloads bar. ( Win 7 , Chrome Beta )
评论 #5430981 未加载
brettcvzabout 12 years ago
Also doesn't work on ubuntu (at least not with scrotwm)
评论 #5430978 未加载
评论 #5430934 未加载
executiveabout 12 years ago
Instructions are incompatible with Chrome OS.
jpetterssonabout 12 years ago
Great for easter eggs!
meeritaabout 12 years ago
Cases uses for this?
tantalorabout 12 years ago
$5 to the first Chrome extension that detects this and kills it.
Siecjeabout 12 years ago
I don't get it?
评论 #5431104 未加载
drivebyacct2about 12 years ago
False. <a href="http://i.imgur.com/7keR7aL.png" rel="nofollow">http://i.imgur.com/7keR7aL.png</a> (Ubuntu 13.04, Plasma/KDE, KWin, Chrome 27.0.1448.0 dev. It says that no matter what I do...)
评论 #5430975 未加载
jQueryIsAwesomeabout 12 years ago
<p><pre><code> console.profile = console.clear = function(){} </code></pre> That's all you need write in the console to stop this annoyance.
评论 #5430990 未加载