Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Getting keyboard events through iframe

A topic by Rek & Devine created 8 days ago Views: 50 Replies: 1
Viewing posts 1 to 2

Hi,

I was wondering if there was a trick to getting keyboard input through the embbeded iframe on a game's page. I can read the mouse input just fine, but I can't seem to get the events like: document.addEventListener("keydown", this.on_keybutton) which works if I open the content of the iframe and use it directly. This is the game in question, and the code that handles input.

Thank you :)

Admin(+1)

The iframe will need to have focus for the contents of the game to receive keyboard events. The user will have to click something in the frame to move their focus inside of it.