I am trying to pass in some initial data to the game similar to this post:
However this example uses a button click and I am trying to do this onload
I have a game that is being contained in an iframe and I am currently doing this from the parent:
iframe.onload = function()
The setVars function defined in the index.html used as the iframe src looks like this:
var gameIDField = document.getElementById("gameID");
var gameID = "2";
gameIDField.value = gameID;
gameIDField is an offscreen textbox in the game with id "gameID"
It seems that the onload is not enough to wait because I'm getting gameIDField as null. I would really like this to be event based if possible, maybe I'm just missing something.
I have confirmed that this will set the text if forcing to script to wait a second or two, but this is not acceptable for a solution