Understanding Webstorage

0 favourites
  • 12 posts
  • Ok I have a question about the webstorage so I can better understand. I created the 'highscore' and 'name' key that is used on the website. Here is the scenario-

    I load up the game in firefox and made the new hi score and its stored. When I don't beat the hi-score it shows me what the current high score is and the person name. Fine right...well load up the same app in IE and played my score was lower than the high score I got in firefox but the application in IE says that it was the new hiscore. So I go back to firefox and I purposely lose as to not to beat any of the scores, it shows what the current high score is what I first made in firefox and not the IE score which was lower . But go over to IE do the same it shows the score that I got in IE not the firefox score which is the highest of the two. Does the webstorage create different file for each browser??

  • Webstorage is not shared between browsers.

  • Ah OK is there a way to store score to make it universal through browsers??

  • Either from a server, or a service, such as clay.io, or gamejolt.com.

  • Clay.io can upload/download save files with the user logged.

    It's not possible (and unsafe) share storage between browsers.

  • I see. Thank you both newt and Keyo. I will have to find other means of doing this at a later time. Was just a test project to get myself familiar with C2 since I am new.

  • PhoenixNightly

    This is amusingly sad and by no means your fault. Many of us mid and older developers have complained about the naming convention by WebStorage. Although the answer of what WebStorage is and how it's used 99% of new users never read the manual nor do they ever check the manual or tutorials for some time. The WebStorage isn't working with my website is asked almost weekly.

    However WebStorage is not storing data to the Web or any WebSite. The name is misleading and we have complained about its misleading name. WebStorage meaning is that the plugin uses Browser based local storing. Keep these key words in mind; LOCAL, BROWSER. WebStorage doesn't use any form of sending information up to the any website.

    In essense WebStorage uses cookies.

  • For offline/nodewebkit, does each exe use a different storage file thing? (so we don't need to worry about conflicting keys.)

  • jayderyu

    Thank you for clearing that up cause when I read the manual this line made me think that the app would create something where it was hosted and keep it there for later usage

    'Storage per domain

    The WebStorage object associates all stored data with the current domain. For example, all games running on scirra.com share the same data, but games running on facebook.com use a different set of data and cannot access any data saved from scirra.com.'

    So I though as long as they was going to one place to play the game the score would be universal. WebStorage uses cookies that explains it way better. I have been trying to figure out what is the usage of the 'Dictionary' for.

  • PhoenixNightly

    Dictionary is a Key/Value data storage. The storage system interface is the same as WebStorage, but Dictionary is all in memory. Also the benefit of Dictionary is that you can do Dictionary.asJson and store an entire Dictionary. However Dictionary also works the same as WebStorage Session which is also temporary.

    So Dictionary is great for data chunk loading and saving. I use it a lot. When you figure out how to embed a normal JSON string into a C2 Data JSON you can load single level JSON strings into C2. Very convenient.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • In essense WebStorage uses cookies.


    In fact it is even less server-based than cookies, cookies are sent to the server to check values, for each request, while webstorage is really 100% client-side

  • Nope. Cookies are local storage set by servers script. However JS can create cookies locally.


    I suspect WebStorage starts with the most common database storage type and then falls back to local cookies.

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