Arche's Forum Posts

  • 2 posts
  • I need to do the opposite (pass information from construct 2 to an external web page) and informations don't need to be secure and will be cleared if user goes back to the Construct2 game page. So if I can avoid a server web page and use only static html/javascript page, it could be great.

    I've found two ways to do this :

      Local storage GET parameters

    With GET parameters it works but all data are stored in the URL which is not convenient for the user. But i'm pretty sure this is the best compatible solution for every browsers. I was not sure if Local Storage is a good solution (that's why i've asked if we can use local forage safely). If you say it could be dangerous, i'll go back to the GET solution (or another best solution if you have).

    Thanks for the answer BTW.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey !

    Same problem here. I've tried to get data from local storage into another page after setting it into Construct2 and vice versa.

    It seems Construct2 developpers use a standard javascript library called "Local Forage" (and not Local Storage). This library is similar to local storage but use asynchronous mechanisms and other storage methods like WebSQL or IndexedDB. That's probably why we need to wait specific events to retrieve our data and that's why we cannot get/set the information using local storage only.

    So if you need to set data into your HTML Page and use it into Construct2, you can check out the local forage library (available here : https://github.com/mozilla/localForage). Follow the examples available in the github page. For me it works like a charm. <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    It could be useful if a Scirra developper may confirm you can use local forage library safely in external web pages to get Construct2 information. It could be dangerous if they decide to make a bridge with specific keys or if the storage priorities are not the same between the HTML Page and the Construct2 source code.

    Cheers !

  • 2 posts