How to embed a Construct 2 project into your website.

You're viewing a single comment in a conversation. View all the comments
  • 1 Comments

  • Order by
  • A simple solution could be to add a query parameter to the game page url/src of the iFrame, then use C3 to pick up that query parameter with the Browser object (See, en.wikipedia.org/wiki/Query_string).

    For example, http...my-website.com/my-game.html?variable_name=some_value

    However, if the variable is not present when the url is created. You may have to use postMessages to communicate information between the iframe and the parent page (See, developer.mozilla.org/en-US/docs/Web/API/Window/postMessage).

    Alternatively, data can be passed via other intermediaries such as iFrame element attributes, LocalStroage/IndexDB, AJAX requests.