Use an input element with CSS
Closed this issue · 2 comments
You can monitor an input element in CSS, as noted by minimax.
Unfortunately, as far as I can tell, this doesn't work. The attribute selector in CSS only works for initial values, not for values that a user enters. Try changing the contents of the input in my linked example.
I was thinking the same, but indeed it won't work with only CSS. From the CSS keylogging readme:
- Open a website that uses a controlled component framework such as React. https://instagram.com.
The "controlled" part is key to the CSS keylogger approach, it means the value
attribute in the DOM will be updated with each change, not just the value
property of the element object.
You can make this "work" with a bit of JavaScript as described here but that's cheating.
Also, dealing with all the possible changes to an input element (non-ASCII characters, emoji, pastes of multiple characters) would be difficult or potentially impossible.