4

The title sums up the question.

I am especially interested for Chrome 68+.

I have a website. I would like to know what code a user executes if he opens the chrome inspector and writes code.

DonJoe
  • 1,603
  • 1
  • 13
  • 24
  • 6
    Nope, not possible. – wOxxOm Jan 25 '19 at 18:46
  • @wOxxOm Ok, correct me if I'm wrong: If this was actually possible, there would be security concerns. – DonJoe Jan 25 '19 at 18:50
  • 2
    It *used* to be possible in Chrome, but it was patched in 2014. See [this answer](https://stackoverflow.com/a/21693931/47589), but instead of throwing an error from `_commandLineAPI `, you instead just take note that a command was entered in the console. This won't work anymore, though. –  Jan 25 '19 at 19:11

2 Answers2

2

The answer is no.

It is impossible for the website to know what code was executed.

It may in many ways be able to detect the side-effects of code run in the console but knowing what was typed is not feasible.

-2

Yes and no because you have to use ctrl-shift-i to inspect in the browser, but that is still just inspecting.