HTML5本地存储数据是否由域分开存储 [英] Is HTML5 Local Storage data stored seperated by domain
问题描述
我已经尝试过浏览HTML5本地存储,但我似乎找不到直接的答案。
I have tried looking around about HTML5 Local Storage but I can't seem to find a straight answer.
本地存储是否基于Domain存储其对象饼干?
Does the Local Storage store its objects based on Domain like cookies?
如果是这样,如何从其他域访问它?
If so how do I access it from another domain?
推荐答案
从规范:
只要
存储$ c $的任何成员,用户代理就必须抛出
SecurityError
异常c>最初由localStorage
属性返回的对象由脚本访问,其有效脚本来源与Document $ c的原点不同访问
localStorage
属性的Window
对象的$ c>。
User agents must throw a
SecurityError
exception whenever any of the members of aStorage
object originally returned by thelocalStorage
attribute are accessed by scripts whose effective script origin is not the same as the origin of theDocument
of theWindow
object on which thelocalStorage
attribute was accessed.
您无法从存储在那里的任何域以外的任何域访问存储在 localStorage
中的数据。它遵循与 XMLHttpRequest
相同的模型 - 相同的原始政策。
You cannot access data stored in localStorage
from any domain other than the one that stored it there. It follows the same model as the XMLHttpRequest
- the "same origin policy".
这篇关于HTML5本地存储数据是否由域分开存储的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!