That would create far too many false positives. The common way is to detect if window.innerWidth changed by a minimum threshold but window.outerWidth did not. The limitations of the method are built in sidebars (such as on Edge with the sidebar and search sidebar) could trigger it as well if your minimum width is not wide enough while on the other hand if your minimum width is too wide you won't catch the dev tools opening. The method is also limited in that undocked dev tools will not register a triggering change.
As others have mentioned, you can simply put in a sourcemap entry in your JS, and when the browser requests that URL (which happens when Devtools opens to prepare for showing original sources), ban the IP.
1. setTimeout to call an endpoint that will block your ip. It's set to run in 2 seconds from now.
2. Insert: debugger;
3. Clear the timeout. Now you run this function as an interval.
If the devtools is closed, debugger will be ignored and the call to this endpoint will never happen. But if it's open, the debugger will stop and the timeout will fire.
Not sure if you need to patch
SetTimeout to continue running while you stop but I hope you get the general idea
Comments (199) 50 threads
Earlier comments1. setTimeout to call an endpoint that will block your ip. It's set to run in 2 seconds from now. 2. Insert: debugger; 3. Clear the timeout.
Now you run this function as an interval. If the devtools is closed, debugger will be ignored and the call to this endpoint will never happen. But if it's open, the debugger will stop and the timeout will fire. Not sure if you need to patch SetTimeout to continue running while you stop but I hope you get the general idea
All comments shown.
Couldn't load more comments. Check your connection and try again.