HTML5 localStorage across files?
Is HTML5 storage shared across other HTML files?
For example if I have files..
index.html
and index2.html
and I set a key info
equal to null
in index can I retrieve this value in in开发者_Go百科dex2.html
? If not, is there anyway of doing this?
You have one localStorage object per origin, the origin being the combination of protocol, host and port. See http://en.wikipedia.org/wiki/Same_origin_policy. So if all your HTML files come from the same protocol/host/port, then they will share the same localStorage.
精彩评论