开发者

HTML5 localStorage across files?

开发者 https://www.devze.com 2023-03-02 17:35 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消