How to get variable value from PARENT window?

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • My game is embedded within an iFrame window on a parent webpage.

    I need my game (inside an iFrame) to read a variable from its PARENT webpage?

  • Please don't post your question repeatedly in the forum. You asked this same question less than 24 hours ago. It takes time to get an answer (if there is one).

    I suggest you read this pinned post about getting help in these forums:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • My game is embedded within an iFrame window on a parent webpage.

    from my experience with iframes in general being it in a game or being it as an iframe on a website, it depends how it loads and where it loads from, but usually you won't be able to alter the inside contents of an iframe, as it won't be hosted on your server. however, if the game is hosted on your server, but you use an iframe to display it on another webpage on your website, you might be able to parse the data, from inside the game at its hosted location to localhost of browser and then on the displayed iframe page you can call the localhost data using javascript. other than that i have no clue.

  • SOLUTION: WAY SIMPLE, Works like a Charm


    Declare your variable in the PARENT Webpage: Anything like this works

    var my_var = 'hello world!';

    In Construct 2 of C3:

    Declare a Global Variable

    On Button Click, or any other Event

    See screenshot

  • SOLUTION: WAY SIMPLE, Works like a Charm

    awesome, is the game hosted on the same server ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)