Pass parameters from html to the game(iframe)

i embed the game with iframe .how can i call the game function “settext” from outside.

settext(stringtext){
        this.label.string = stringtext;
    }


I did this code but it doesn’t work…
thank everyone

You need to register a listener inside the game to get the message -

window.addEventListener("message", function (e) {
    const command = e.data;
    //...
}
3 Likes

That’s correct, you will have to do something like this:
[Accessing the HTML5 game from outside. - #4 by vkgamedev](Code Snippet)

1 Like

it worked, thank you very much

yeah,thank youuuu

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.