Hacker News new | ask | show | jobs
by omgomgomgomg 1183 days ago
How is this detected in js, if possible?

Is there a dev tools open event or does it detect f keys and right click events?

1 comments

One of the ways this is detected is by window resizing. You can see an example npm package that can detect devtools here: https://github.com/sindresorhus/devtools-detect
Like they say there, there are other reasons that the window might be resized, including other sidebars, or split screen (if you use a browser that has this feature), or possibly even printing the document (since the page will have different dimensions than the screen), or resizing the window if you have other programs open at the same time, etc.

I had wanted to prevent web pages from detecting the window height, which has many benefits, including this but also prevents using the window height to override font sizes, preventing auto-loading on scrolling, and auto-scrolling ads into view, in addition to the debugger.

Additionally, detecting the outer window size should not be possible at all; it is not useful. Only the document view area is useful to detect anyways.