Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DevTools Undocked #15

Open
ghost opened this issue Oct 29, 2014 · 12 comments

Comments

@ghost
Copy link

commented Oct 29, 2014

I there's a polyfill or an idea to fix when DevTools is undocked, it should be added to this thread.

@arthurvr

This comment has been minimized.

Copy link
Collaborator

commented May 15, 2015

I don't think there actually is, at least not using the approach we're currently taking to detect if devtools are open.

@mtx-z

This comment has been minimized.

Copy link

commented Apr 29, 2016

Those two ones (Fiddle one & two) use the same approach to detect Chrome devtools. It also detect in undocked. Do you think it's possible to implement in your script ? ty :)
Edit: maybe it's easier to use your script for everything but Chrome devtools, and use the Fiddle ones for Chrome ?

@sksar

This comment has been minimized.

Copy link

commented Sep 2, 2016

The fiddle ones are seriously genius pieces of insanely useful code,,,,

@EbiPenMan

This comment has been minimized.

Copy link

commented Sep 14, 2017

for this problem you can add this code:

var minimalUserResponseInMiliseconds = 100; var before = new Date().getTime(); debugger; var after = new Date().getTime(); if (after - before > minimalUserResponseInMiliseconds) { // user had to resume the script manually via opened dev tools // is opened }

@kdzwinel

This comment has been minimized.

Copy link

commented Jan 7, 2018

The getter hack relied on a bug - browser DevTools should never automatically invoke getters as these may have side effects. Firefox (I tested in 57) and Chrome (65 - currently in canary) already patched it up. Only major browsers where it still works are Safari and Edge.


BTW I found another one that abuses the fact that many developers have cache disabled when DevTools are open:

http://jsbin.com/vanogec/edit?js,output

Works in all major browsers even if DevTools are undocked, but has a side effect of making a request.

@eligrey

This comment has been minimized.

Copy link

commented Jan 7, 2018

Here's my idea for devtools detection: https://jsfiddle.net/eligrey/j4v270p4/

I think this solution is much more difficult to mitigate.

@eligrey

This comment has been minimized.

Copy link

commented Jan 7, 2018

Apparently the method I posted isn't that accurate in Firefox, although it is pretty accurate in Chrome.

@ngyikp

This comment has been minimized.

Copy link

commented Jan 7, 2018

@kdzwinel Yup, this seems to be the Chrome bug report: https://bugs.chromium.org/p/chromium/issues/detail?id=795547

@souravndp

This comment has been minimized.

Copy link

commented Jan 7, 2018

@kdzwinel

This comment has been minimized.

Copy link

commented Jan 7, 2018

@ngyikp thanks! Quick look at the diff of the patch reveals that only some properties were patched while others are still vulnerable to the same getter hack. I opened another report: crbug.com/799791.

[EDIT] Patched in Canary

@ziozec

This comment has been minimized.

Copy link

commented Apr 17, 2018

@mtx-z unfortunately your solution doesn' t work anymore :-(

@kdzwinel

This comment has been minimized.

Copy link

commented Jun 18, 2019

I found myself discussing this and thinking about this again, so here goes a braindump.

There are four techniques that still can be used to detect DevTools (that I know of). Thankfully, all of them can be migrated:

  1. screen size change (detach devtools to migrate),
  2. "debugger;" statements ("Deactivate breakpoints" to migrate),
  3. cache not working - #15 (comment) (don't disable the cache),
  4. source maps getting fetched (check off "Enable JavaScript source maps" in DevTools settings).

If everything fails and code you are trying to debug is still detecting DevTools:

  • please ping me, so I can take a look,
  • you can still use lower level tools (such as Debugging Protocol or chrome://net-export/).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
9 participants
You can’t perform that action at this time.