Skip to content Skip to sidebar Skip to footer

Can Localstorage Data Created And Saved In One Html File Can Be Used In Another Html File?

I am creating a completely offline HTML5 app using localStorage. I have successfully saved and retrieved and manipulated localStorage data in a single .HTML file. Anyhow, now when

Solution 1:

localStorage is controlled by same-origin policy Assuming you're using file:// it varies by browser:

Webkit:

All file:// documents have the same origin https://bugs.webkit.org/show_bug.cgi?id=20701

Mozilla:

In Gecko 1.8 or earlier, any two file: URIs are considered to be same-origin. In other words, any HTML file on your local disk can read any other file on your local disk.

Starting in Gecko 1.9, files are allowed to read only certain other files. Specifically, a file can read another file only if the parent directory of the originating file is an ancestor directory of the target file. Directories cannot be loaded this way, however.

https://developer.mozilla.org/en-US/docs/Same-origin_policy_for_file:_URIs

IE:

Doesnt apply (see: localStorage object is undefined in IE)

Post a Comment for "Can Localstorage Data Created And Saved In One Html File Can Be Used In Another Html File?"