dmauro / Keypress

A keyboard input capturing utility in which any key can be a modifier key.
http://dmauro.github.io/Keypress/
Apache License 2.0
3.18k stars 313 forks source link

TypeError: window.keypress is undefined #143

Open YTCuber opened 6 years ago

YTCuber commented 6 years ago

When I load the Keypress script in my own site or even on https://dmauro.github.io/Keypress/, it does not work at all.

Browser: Firefox Quantum 60.0.1 (64 bit) OS: Ubuntu 17.10

Error messages: TypeError: window.keypress is undefined in main.js:5:3 Trace:

@https://dmauro.github.io/Keypress/js/main.js:5:3 @https://dmauro.github.io/Keypress/js/main.js:2:2
akhzarjaved commented 3 years ago

@YTCuber Any solution on this ? same error occurring for me

mangru commented 3 years ago

Same problem for me: window.keypress is undefined

jjuambel commented 3 years ago

Hi.

Not sure if you have already tried this but in my case it was a silly mistake.

In my HTML code I was loading my own JS file -from where I was trying to use keypress- before loading keypress.js itself.

<script src='js/myFile.js'></script> <script src='js/keypress.js'></script>

I moved the reference to keypress.js to the top

<script src='js/keypress.js'></script> <script src='js/myFile.js'></script>

and that was it.

Hope this helps.

Same problem for me: window.keypress is undefined