- Home /
WebGL Canvas/Keyboard focus
i have uploaded a game to kongregate and the keyboard input isn't focused on the canvas. I have tried adding code to the index.html file I've found whilst looking around for solution but it didn't seem to make a difference. I am not fantastic with html but from what I've read the issue seems to be the use of i frames interfering with keyboard input or indexes on the webpage, anyway I've been searching for quite a while now and no fixes.
Does anyone know a solution to this? if anyone has had this problem and solved it, i would be very grateful to know how you did it :).
Thank you.
Answer by Paricus · Aug 21, 2015 at 12:24 PM
I fixed it! if any one else has the same problem and stumbles across this question i added this code to the head in the index.html file
<script type='text/javascript'>
document.onmousedown = function() {window.focus();};
</script>