Search code examples
javascriptdom-eventskeypressdispatchevent

Dispatching a key event in Firefox 12


I used to dispatch a key event in FireFox 10 and 11. Recently I update my browser to FireFox 12 and dispatching stop working.

Here is a sample code of what I've been done.

When you run it in Firefox 11 or less, you can find a character printed in the textbox.

Why it doesn't work in Firefox 12, and how can I fix it? Any alternative solution is also appropriated.


Solution

  • This is their answer in BugZilla. Dispatching key event seem's to be rejected anymore for security reasons:

    Please note that initKeyEvent() still works. Editors just refuse the key events for both security and unclear in current spec.

    But I still can't realize why my dispatched event is untrusted.