How do I used webstorage ?

0 favourites
  • 6 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • Hello,

    I'm using webstorage to save the best score of my game, but I don't understand, in my localhost it works perfect!, but when I published my game on a server, it only got a zero (like if the data couldn't be load nor saved)...

    what would it be ?...

    webstorage works on remote ?....

    thank you very much.

  • webstorage stores data in the browser, not in a server as far as I know, if you save it local it will stay there until the browser's cache/cookies is cleaned, if saved session, data will be lost when closing the browser

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think the answers are in the manual https://www.scirra.com/manual/120/webstorage

    "The WebStorage object can store data locally on the user's computer"

    "WebStorage does not store in the browser cache."

    "if the user opts to clear all their cookies or offline website data, WebStorage will be cleared. "

  • Thanks for your replies...

    I think, I didn't explain it well. I've already known web storage stored data in the local computer (client that is playing), but my problem is that when I test my game on my localhost (run from construct2) webstorage works fine. But if I compile (as HTML5 for example) and then I upload the code to my game server, and I play it from my computer then the web storage doesn't work and I don't understand why, all I've got is a zero as value.

  • Try running the compiled version on your localhost...

    The next option would be to post your capx file here...

    What is showing a zero value and when? Something at the start of the game - the high score, player score or lives or something else never change?

    When, where, how do you need this zero value to change?

  • Hello maxxscape, thanks for your answer...

    I tried to run the compiled version... but it doesn't work on localhost.

    The zero value is showing on a text object that shows the best score, the condition is that on start of layout (you can see in the atachment).

    I'm using it to store the high score of the player.

    This text could change to "Your best score: X"...

    I saw another thing, if I use firebug I can see this error:

    "Application Cache Error event: Manifest fetch failed (404)"

    what does it mean ?...

    thank you very much.

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