This is a more specific question of Is it possible to simulate key press events programmatically? Every answer is missing the following information in one way or another, reducing the question’s value. I’ve tried three things on there already that didn’t work in modern browsers, or were advised against by official sources.
I want this question to be the one stop
Here is what I’m looking for:
- At the time of answering, every example should work in modern versions of Firefox and Chrome.
- No examples include deprecated objects, fields, properties, or functions.
Every answer should include a way of typing a printable character in a textfield and textarea.As mentioned in a comment below, this can’t be done.
- Every answer should include a way to type an alphanumeric character when an input does not have focus. e.g., "a", "b", "c", etc.
- Every answer should include a way to type a non-printable character. e.g., page down, left arrow, the F1 key (if this isn’t possible, it’s okay to state so), Enter, etc.
- Every answer should include a link to all the "codes" needed to simulate alphanumeric characters and non-printable characters, or even better, embed that info into the answer. I’m using the term "codes" loosely here: I mean whatever term is appropriate to to satisfy the 2nd point.