Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
26
rated 0 times [  27] [ 1]  / answers: 1 / hits: 18580  / 10 Years ago, mon, july 28, 2014, 12:00:00

I am creating 2 HTML files that will be stored an an iPhone locally and accessed through a WebView.



I am wondering if it is possible to set localStorage in one file, and get the results of the storage from the other file.



I know that localStorage is accessible from files on the same domain, however, it appears that you can not get the value from a different local file?



I have also tried running this in Safari on the desktop with local files and the same issue occurs.


More From » html

 Answers
1

When you are opening the files locally, i.e. using the file:// protocol, as of now the browsers can not determine what is same domain so every file is considered a separate domain. Thus you can not use localStorage when you're opening the files.



Here is some more information on the problem in FireFox: https://bugzilla.mozilla.org/show_bug.cgi?id=507361 . Personally I couldn't find much about Safari on this topic.



You can also look over this: Javascript/HTML Storage Options Under File Protocol (file://) . It might be helpful in your situation.


[#70016] Friday, July 25, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
chelseyn

Total Points: 36
Total Questions: 85
Total Answers: 89

Location: Laos
Member since Fri, Sep 11, 2020
4 Years ago
chelseyn questions
;