14

I tried localStorage in HTML for my project. When I save some data using localStorage in one browser and try to read it in another browser, it fails.

  1. How can I save data that is common across all browsers, like Flex is doing?

  2. And where these data are stored in Windows 7?

Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
user10
  • 5,186
  • 8
  • 43
  • 64
  • See [AmplifyJS](http://amplifyjs.com/api/store/) (see also: [browser compatibility of `localStorage`](http://caniuse.com/#search=localstorage)). – Rob W Jul 11 '12 at 09:19
  • 2
    You can save data across multiple browsers by storing it server side - in a database for example – Manse Jul 12 '12 at 08:06

1 Answers1

16
  1. This is not possible.

  2. Every browser stores it in its own location (this is the reason it is not possible). The localStorage is not an OS service, it is part of HTML5 specification, which is implemented by each browser separately.

Dor Cohen
  • 16,769
  • 23
  • 93
  • 161
poncha
  • 7,726
  • 2
  • 34
  • 38
  • 1
    it is really stupid to ask user to store data each time, when they open same app in different browsers. – user10 Jul 11 '12 at 09:55
  • 2
    and if the data has been changed? you will need an ability to sync it anyway. – poncha Jul 11 '12 at 10:15
  • how adobe guys do it? once we stored data using sharedObject, they give it back to you no matter what browser you are using.can't we achieve this localStorage? if we can't someone should propose about this feature to W3c. – user10 Jul 18 '12 at 09:28
  • @user10 adobe (flash?) can do this kind of thing, because flash plugin is being installed everywhere, but how it handles stuff (including configuration, storage, etc) is entirely up to adobe... as for proposing this to w3c, i'm not sure it would be a good idea security wise... this way security hole in one browser may have effect on other browsers as well – poncha Jul 19 '12 at 15:22
  • 3
    @user10: “it is really stupid to ask user to store data each time, when they open same app in different browsers” — you could store the user’s data on your server instead. – Paul D. Waite Jul 20 '12 at 07:36
  • @poncha if the data were changed, with the shared localstorage, it'll be more cohesive to have one cluster for each site, attending specific conditions on the browser session settings. On the app, the structure need to be resilient and update itself with timestamps, for example, associating one life cycle for the data tree. There's many options to do it, but the localStorage really need to be cross browser accessible. – Mateus Leon Nov 04 '14 at 19:33
  • @PaulD.Waite and if the app needs to be operable offline, using the localStorage to keep the data until the user can access the internet? The solutions aren't simple as that, they need to be more detailed. – Mateus Leon Nov 04 '14 at 19:35
  • @MateusDuartePoncedeLeon: the solution to a given problem *might* be as simple as that; it depends on the problem. I was just making a suggestion. – Paul D. Waite Nov 05 '14 at 00:13