Apparently, document.addEventListener()
is unreliable, and hence, my error. Use window.addEventListener()
with the same parameters, instead.
More Related Contents:
- Removing an anonymous event listener
- addEventListener calls the function without me even asking it to
- How to check whether dynamically attached event listener exists or not?
- Binding multiple events to a listener (without JQuery)?
- How to get an AJAX get-request to wait for the page to be rendered before returning a response?
- Correct usage of addEventListener() / attachEvent()?
- How can I intercept XMLHttpRequests from a Greasemonkey script?
- Why is window (and unsafeWindow) not the same from a userscript as from a tag?
- Javascript: Uncaught TypeError: Cannot call method ‘addEventListener’ of null
- JavaScript listener, “keypress” doesn’t detect backspace?
- Injecting JS functions into the page from a Greasemonkey script on Chrome
- Simulating a mousedown, click, mouseup sequence in Tampermonkey?
- Userscript to wait for page to load before executing code techniques?
- How to change a class CSS with a Greasemonkey/Tampermonkey script?
- How can I detect visited and unvisited links on a page?
- Save images to hard disk WITHOUT prompt?
- Detecting combination keypresses (Control, Alt, Shift)?
- addEventListener on NodeList [duplicate]
- Javascript multiple dynamic addEventListener created in for loop – passing parameters not working
- How can you determine the file size in JavaScript?
- Storing user login/password input in a Greasemonkey script on install
- How do I click on this button with Greasemonkey?
- How to use GM_xmlhttpRequest in Injected Code?
- reactjs event listener beforeunload added but not removed
- Watch for element creation in greasemonkey script?
- Listen to multiple keydowns
- addEventListener gone after appending innerHTML
- Chrome userscript error: “Unsafe JavaScript attempt to access frame”
- Error: Permission denied to access property ‘handler’
- How do I get Greasemonkey to click on a button that only appears after a delay?