![]() |
localStorage/sessionStorage question
Hello, everyone.
I'm learning localStorage and sessionStorage, but I have a question that I have not found via Google, yet. Local vs. Server: I've tested localStorage in IE8 and FireFox 12 in HTML documents stored on a development server, and it's working.. excellently. However, I tried testing with a .htm document that I created (via NotePad) on my Desktop, and it's not working.. at all. For localStorage, is location going to determine if it's going to work? Will it not work, if it's on the same machine from which I am testing? Thank you, |
Quote:
There are a growing number of things in JavaScript that behave differently if the script is running via a web server (whether local or remote) to how it runs if you try to just access the file locally. Some browsers eg. IE will not allow any JavaScript at all to be run outside of a server unless you specifically allow it each time you want to run it and then it may not run the same as it would on a server. While it is obvious that cookies will not work if you try to run the page directly without a web server as the cookies get passed to and from the server it isn't as obvious why localStorage should have the same restriction except that the security is supposed to work based on the domain name and pages run directly don't have a domain name (which is one possibility as to why it doesn't work outside a server). |
there's no localStorage for local files in IE. or localhost for firefox, or whatever...
|
Quote:
|
[QUOTE=felgall;1316226]Not sure I understand what you untended that part to mean.
there's no localStorage for local files in IE. there's no localStorage for localhost for firefox. luckily, 127.0.0.1 has localStrorage in FF. |
Quote:
Opening the .htm using localhost:8500/test.htm - localStorage works! Thanks, felgall! |
| All times are GMT +1. The time now is 02:18 AM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.