腰椎疼痛吃什么药| 寒湿重吃什么中成药| 角化棘皮瘤是什么病| qs排名是什么意思| 魔性是什么意思| 解痉是什么意思| 甘油是什么成分| 月经推迟一个月不来什么原因| 完全性右束支阻滞是什么意思| 眼睛像什么| zeiss是什么意思| 史诗级什么意思| 农历六月十四是什么日子| 梦到人死了是什么意思| 三月七号是什么星座| 什么是白脉病| 什么病不能吃茄子| 骨折恢复期吃什么好| 四川有什么烟| 低密度脂蛋白偏低是什么意思| 孕妇血压低吃什么能补上来| 崩大碗配什么煲汤最好| 咽炎吃什么好| 车抛锚是什么意思| 血小板高是什么问题| ml是什么| 锁骨中间的窝叫什么| 埋伏是什么意思| 深渊什么意思| ibm是什么| 坚果什么时候吃最好| 眼皮红肿是什么原因引起的| 类胡萝卜素主要吸收什么光| 心电图异常q波什么意思| 角质层是什么| 化疗期间吃什么食物好| 农历7月28日是什么星座| 均匀是什么意思| 寄生树有什么功效作用| 什么是亲情| 受害者是什么意思| 独一味是什么药| 男性支原体感染什么症状| 鱼香肉丝用什么肉做| 脚肿吃什么药消肿| 特斯拉是什么电池| 伤官代表什么| 什么可以吃| 眉目比喻什么| 血钾高是什么引起的| 豆浆配什么主食当早餐| 神龛是什么意思| 淋证是什么病| 劳动局全称叫什么| 性格内向的人适合做什么工作| 鱼吐泡泡是什么原因| 为什么睡不着觉会胡思乱想| va是什么维生素| 抗衡是什么意思| 四月二十六是什么星座| 龙日冲狗要忌讳什么| 腰椎退行性改变是什么意思| 尊敬是什么意思| 什么叫红肉| zw是什么意思| 病毒感染发烧吃什么药| 神迹是什么意思| b什么意思| gerd是什么病| 艸是什么意思| 什么是丝状疣| 什么是乙肝病毒携带者| 卵巢囊性包块是什么意思| 漫谈是什么意思| 碳酸钙d3颗粒什么时候吃最好| 夜盲症缺什么维生素| 男人下面有异味什么原因| 澳门回归是什么时候| 芈月是秦始皇什么人| 有眼袋是什么原因| maxco是什么牌子| 白细胞低吃什么补得快| 为什么发动文化大革命| 今天什么冲什么| 一月五日是什么星座| n0是什么意思| 人为什么会做噩梦| 右脸长痣代表什么意思| 肝内钙化灶是什么意思| 社保基数什么时候调整| 釉是什么| 心阴虚吃什么食物| 无所适从什么意思| 傍晚是什么时候| 水加日念什么| 一直鼻塞是什么原因| 动卧是什么意思| 唾液酸是什么| 血红蛋白低吃什么| 什么是黑色素瘤| 长长的什么| 金桔什么时候开花结果| 卜在姓氏里读什么| 拜阿司匹林什么时间吃最好| 吃什么利尿| 糖耐量异常是什么意思| 蛇和什么属相最配| 什么是幽门螺旋杆菌| 邮箱地址填什么| 心率过快挂什么科| 梨花是什么颜色| 搏击是什么运动| 十二生肖为什么老鼠排第一| 子欲养而亲不待是什么意思| 血便是什么原因引起的| 外来猫进家有什么预兆| 胎盘厚度代表什么| nikon是什么牌子| 2型糖尿病吃什么药降糖效果好| 憩室是什么病| 水险痣什么意思| 梦见捡到钱是什么意思| hairy什么意思| 闻风丧胆指什么动物| 处暑吃什么| 瘤变是什么意思| 异的偏旁是什么| 放疗化疗有什么区别| 南瓜什么季节成熟| 偶尔胸闷是什么原因| 随波逐流什么意思| 覆盖是什么意思| azul是什么颜色| 乙肝抗体阴性是什么意思| 碱性磷酸酶偏高是什么原因| 证监会是干什么的| 鹿晗的原名叫什么| 2段和3段奶粉有什么区别| 抽象什么意思| 梦见被蛇追着咬是什么意思| 妇科检查bv是什么意思| 更年期失眠吃什么药调理效果好| 支气管炎吃什么药最有效| 什么得什么造句| 锅烧是什么| 饴糖是什么糖| 被告不出庭有什么后果| 杠是什么意思| 死缓是什么意思| 麻药过敏什么症状| 孕早期头疼是什么原因| 阴道出血吃什么药| 槟榔是什么味道| 怀孕十天左右有什么反应| 公招是什么意思| 产生幻觉是什么原因| 低压高是什么原因| 周杰伦得了什么病| 卡介疫苗什么时候打| 撇清关系是什么意思| belle是什么牌子| 抽象思维是什么意思| 西凤酒属于什么香型| 头抖是什么原因| 小朋友口臭是什么原因| cr是什么检查| 青团是什么节日吃的| 沐猴而冠代表什么生肖| 貔貅什么人不能戴| 澳门回归是什么时候| apart是什么意思| 两个束念什么| 二胎什么时候放开的| 心可舒治什么病| 五位一体是什么| 农历五月二十八是什么日子| 清朝为什么会灭亡| 大便的颜色代表什么| 不知道为什么| 早上起来后背疼是什么原因| 宫闱是什么意思| 95年属什么多大| 胆小如鼠是什么生肖| 波立维是什么药| 贵人是什么意思| 什么星座最花心| 预科班什么意思| 介词后面跟什么| 淡定自若什么意思| 秋天有什么景物| 92年出生属什么生肖| rm是什么币| 洋葱有什么功效与作用| 长痘要忌口什么东西| 孕期应该吃什么| 肝脏在人体的什么位置| 静脉曲张有什么危害| 单人旁的字和什么有关| 看输卵管是否堵塞做什么检查| 鼻窦炎是什么原因引起的呢| dp什么意思| 狐狸狗是什么品种| 用你的手解我的锁是什么歌| 双子座是什么象| 也字五行属什么| 女人抖腿代表什么意思| 马为什么不怕蛇毒| 吃什么增肥| 经常肚子痛什么原因| 錾是什么意思| 蒙昧是什么意思| 低血压有什么症状| 杏花什么时候开| 圆脸适合什么短发发型| 不宁腿综合症是什么原因引起的| 股骨头坏死有什么好办法治疗吗| 痛风吃什么好| 说笑了是什么意思| 826是什么星座| 什么方法可以快速入睡| 布朗是什么水果| 李子不能和什么一起吃| 治白内障用什么药最好| 泉中水是什么生肖| 荡漾是什么意思| 头孢吃多了有什么副作用| 89年的蛇是什么命| 官方翻新机是什么意思| 霉菌性阴炎用什么药好得快| 什么的梨花| 什么样的花朵| 检查盆腔炎做什么检查| 睡觉出汗是什么原因男性| 8月份什么星座| 插入阴道是什么感觉| 吃完泡面吃什么解毒| 淋巴细胞绝对值偏低说明什么| sahara是什么牌子| 目赤是什么症状| 割韭菜是什么意思| 间质性肺病是什么意思| 四月二十八什么星座| 肉桂茶是什么茶| 什么是dha| 望梅止渴是什么梅| 什么是直辖市| 溶血性黄疸是什么原因引起的| 梦见自己掉牙是什么意思| 乱花渐欲迷人眼是什么意思| 下旬是什么意思| 玉镯子断了有什么预兆| 检查肠胃挂什么科| 结婚十年是什么婚| taco什么意思| 男人遗精是什么原因造成的| 什么时候量血压最准| 梦见奶奶死了是什么意思| 文科女生学什么专业好| 血糖高可以喝什么饮料| 什么的风雨| 尿常规能查出什么| 蜱虫咬人后有什么症状| 乳腺增生挂什么科| 晚上七点半是什么时辰| 百度
  1. 12 Web storage
    1. 12.1 Introduction
    2. 12.2 The API
      1. 12.2.1 The Storage interface
      2. 12.2.2 The sessionStorage getter
      3. 12.2.3 The localStorage getter
      4. 12.2.4 The StorageEvent interface
    3. 12.3 Privacy
      1. 12.3.1 User tracking
      2. 12.3.2 Sensitivity of data
    4. 12.4 Security
      1. 12.4.1 DNS spoofing attacks
      2. 12.4.2 Cross-directory attacks
      3. 12.4.3 Implementation risks

12 Web storage

Web_Storage_API

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

Web_Storage_API/Using_the_Web_Storage_API

12.1 Introduction

This section is non-normative.

This specification introduces two related mechanisms, similar to HTTP session cookies, for storing name-value pairs on the client side. [COOKIES]

The first is designed for scenarios where the user is carrying out a single transaction, but could be carrying out multiple transactions in different windows at the same time.

Cookies don't really handle this case well. For example, a user could be buying plane tickets in two different windows, using the same site. If the site used cookies to keep track of which ticket the user was buying, then as the user clicked from page to page in both windows, the ticket currently being purchased would "leak" from one window to the other, potentially causing the user to buy two tickets for the same flight without noticing.

To address this, this specification introduces the sessionStorage getter. Sites can add data to the session storage, and it will be accessible to any page from the same site opened in that window.

For example, a page could have a checkbox that the user ticks to indicate that they want insurance:

<label>
 <input type="checkbox" onchange="sessionStorage.insurance = checked ? 'true' : ''">
  I want insurance on this trip.
</label>

A later page could then check, from script, whether the user had checked the checkbox or not:

if (sessionStorage.insurance) { ... }

If the user had multiple windows opened on the site, each one would have its own individual copy of the session storage object.

The second storage mechanism is designed for storage that spans multiple windows, and lasts beyond the current session. In particular, web applications might wish to store megabytes of user data, such as entire user-authored documents or a user's mailbox, on the client side for performance reasons.

Again, cookies do not handle this case well, because they are transmitted with every request.

The localStorage getter is used to access a page's local storage area.

The site at example.com can display a count of how many times the user has loaded its page by putting the following at the bottom of its page:

<p>
  You have viewed this page
  <span id="count">an untold number of</span>
  time(s).
</p>
<script>
  if (!localStorage.pageLoadCount)
    localStorage.pageLoadCount = 0;
  localStorage.pageLoadCount = parseInt(localStorage.pageLoadCount) + 1;
  document.getElementById('count').textContent = localStorage.pageLoadCount;
</script>

Each site has its own separate storage area.

The localStorage getter provides access to shared state. This specification does not define the interaction with other agent clusters in a multiprocess user agent, and authors are encouraged to assume that there is no locking mechanism. A site could, for instance, try to read the value of a key, increment its value, then write it back out, using the new value as a unique identifier for the session; if the site does this twice in two different browser windows at the same time, it might end up using the same "unique" identifier for both sessions, with potentially disastrous effects.

12.2 The API

Storage

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

12.2.1 The Storage interface

[Exposed=Window]
interface Storage {
  readonly attribute unsigned long length;
  DOMString? key(unsigned long index);
  getter DOMString? getItem(DOMString key);
  setter undefined setItem(DOMString key, DOMString value);
  deleter undefined removeItem(DOMString key);
  undefined clear();
};
storage.length

Storage/length

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

Returns the number of key/value pairs.

storage.key (n)

Storage/key

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs.

value = storage.getItem (key)

Storage/getItem

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+
value = storage[key]

Returns the current value associated with the given key, or null if the given key does not exist.

storage.setItem (key, value)

Storage/setItem

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+
storage[key] = value

Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.

Throws a "QuotaExceededError" DOMException if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)

Dispatches a storage event on Window objects holding an equivalent Storage object.

storage.removeItem (key)

Storage/removeItem

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+
delete storage[key]

Removes the key/value pair with the given key, if a key/value pair with the given key exists.

Dispatches a storage event on Window objects holding an equivalent Storage object.

storage.clear()

Storage/clear

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android6+Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

Removes all key/value pairs, if there are any.

Dispatches a storage event on Window objects holding an equivalent Storage object.

A Storage object has an associated:

map
A storage proxy map.
type
"local" or "session".

To reorder a Storage object storage, reorder storage's map's entries in an implementation-defined manner.

Unfortunate as it is, iteration order is not defined and can change upon most mutations.

To broadcast a Storage object storage, given a key, oldValue, and newValue, run these steps:

  1. Let thisDocument be storage's relevant global object's associated Document.

  2. Let url be the serialization of thisDocument's URL.

  3. Let remoteStorages be all Storage objects excluding storage whose:

    and, if type is "session", whose relevant settings object's associated Document's node navigable's traversable navigable is thisDocument's node navigable's traversable navigable.

  4. For each remoteStorage of remoteStorages: queue a global task on the DOM manipulation task source given remoteStorage's relevant global object to fire an event named storage at remoteStorage's relevant global object, using StorageEvent, with key initialized to key, oldValue initialized to oldValue, newValue initialized to newValue, url initialized to url, and storageArea initialized to remoteStorage.

    The Document object associated with the resulting task is not necessarily fully active, but events fired on such objects are ignored by the event loop until the Document becomes fully active again.


The length getter steps are to return this's map's size.

The key(index) method steps are:

  1. If index is greater than or equal to this's map's size, then return null.

  2. Let keys be the result of running get the keys on this's map.

  3. Return keys[index].

The supported property names on a Storage object storage are the result of running get the keys on storage's map.

The getItem(key) method steps are:

  1. If this's map[key] does not exist, then return null.

  2. Return this's map[key].

The setItem(key, value) method steps are:

  1. Let oldValue be null.

  2. Let reorder be true.

  3. If this's map[key] exists:

    1. Set oldValue to this's map[key].

    2. If oldValue is value, then return.

    3. Set reorder to false.

  4. If value cannot be stored, then throw a "QuotaExceededError" DOMException.

  5. Set this's map[key] to value.

  6. If reorder is true, then reorder this.

  7. Broadcast this with key, oldValue, and value.

The removeItem(key) method steps are:

  1. If this's map[key] does not exist, then return.

  2. Set oldValue to this's map[key].

  3. Remove this's map[key].

  4. Reorder this.

  5. Broadcast this with key, oldValue, and null.

The clear() method steps are:

  1. Clear this's map.

  2. Broadcast this with null, null, and null.

12.2.2 The sessionStorage getter

interface mixin WindowSessionStorage {
  readonly attribute Storage sessionStorage;
};
Window includes WindowSessionStorage;
window.sessionStorage

Window/sessionStorage

Support in all current engines.

Firefox2+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android?Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

Returns the Storage object associated with that window's origin's session storage area.

Throws a "SecurityError" DOMException if the Document's origin is an opaque origin or if the request violates a policy decision (e.g., if the user agent is configured to not allow the page to persist data).

A Document object has an associated session storage holder, which is null or a Storage object. It is initially null.

(This is a tracking vector.) The sessionStorage getter steps are:

  1. If this's associated Document's session storage holder is non-null, then return this's associated Document's session storage holder.

  2. Let map be the result of running obtain a session storage bottle map with this's relevant settings object and "sessionStorage".

  3. If map is failure, then throw a "SecurityError" DOMException.

  4. Let storage be a new Storage object whose map is map.

  5. Set this's associated Document's session storage holder to storage.

  6. Return storage.

After creating a new auxiliary browsing context and document, the session storage is copied over.

12.2.3 The localStorage getter

interface mixin WindowLocalStorage {
  readonly attribute Storage localStorage;
};
Window includes WindowLocalStorage;
window.localStorage

Window/localStorage

Support in all current engines.

Firefox3.5+Safari4+Chrome4+
Opera10.5+Edge79+
Edge (Legacy)12+Internet Explorer8+
Firefox Android?Safari iOS?Chrome Android?WebView Android37+Samsung Internet?Opera Android11+

Returns the Storage object associated with window's origin's local storage area.

Throws a "SecurityError" DOMException if the Document's origin is an opaque origin or if the request violates a policy decision (e.g., if the user agent is configured to not allow the page to persist data).

A Document object has an associated local storage holder, which is null or a Storage object. It is initially null.

(This is a tracking vector.) The localStorage getter steps are:

  1. If this's associated Document's local storage holder is non-null, then return this's associated Document's local storage holder.

  2. Let map be the result of running obtain a local storage bottle map with this's relevant settings object and "localStorage".

  3. If map is failure, then throw a "SecurityError" DOMException.

  4. Let storage be a new Storage object whose map is map.

  5. Set this's associated Document's local storage holder to storage.

  6. Return storage.

12.2.4 The StorageEvent interface

StorageEvent

Support in all current engines.

Firefox13+Safari4+Chrome1+
Opera12.1+Edge79+
Edge (Legacy)12+Internet Explorer9+
Firefox Android?Safari iOS3+Chrome Android?WebView Android37+Samsung Internet?Opera Android12.1+
[Exposed=Window]
interface StorageEvent : Event {
  constructor(DOMString type, optional StorageEventInit eventInitDict = {});

  readonly attribute DOMString? key;
  readonly attribute DOMString? oldValue;
  readonly attribute DOMString? newValue;
  readonly attribute USVString url;
  readonly attribute Storage? storageArea;

  undefined initStorageEvent(DOMString type, optional boolean bubbles = false, optional boolean cancelable = false, optional DOMString? key = null, optional DOMString? oldValue = null, optional DOMString? newValue = null, optional USVString url = "", optional Storage? storageArea = null);
};

dictionary StorageEventInit : EventInit {
  DOMString? key = null;
  DOMString? oldValue = null;
  DOMString? newValue = null;
  USVString url = "";
  Storage? storageArea = null;
};
event.key

Returns the key of the storage item being changed.

event.oldValue

Returns the old value of the key of the storage item whose value is being changed.

event.newValue

Returns the new value of the key of the storage item whose value is being changed.

event.url

Returns the URL of the document whose storage item changed.

event.storageArea

Returns the Storage object that was affected.

The key, oldValue, newValue, url, and storageArea attributes must return the values they were initialized to.

The initStorageEvent(type, bubbles, cancelable, key, oldValue, newValue, url, storageArea) method must initialize the event in a manner analogous to the similarly-named initEvent() method. [DOM]

12.3 Privacy

12.3.1 User tracking

A third-party advertiser (or any entity capable of getting content distributed to multiple sites) could use a unique identifier stored in its local storage area to track a user across multiple sessions, building a profile of the user's interests to allow for highly targeted advertising. In conjunction with a site that is aware of the user's real identity (for example an e-commerce site that requires authenticated credentials), this could allow oppressive groups to target individuals with greater accuracy than in a world with purely anonymous web usage.

There are a number of techniques that can be used to mitigate the risk of user tracking:

Blocking third-party storage

User agents may restrict access to the localStorage objects to scripts originating at the domain of the active document of the top-level traversable, for instance denying access to the API for pages from other domains running in iframes.

Expiring stored data

User agents may, possibly in a manner configured by the user, automatically delete stored data after a period of time.

For example, a user agent could be configured to treat third-party local storage areas as session-only storage, deleting the data once the user had closed all the navigables that could access it.

This can restrict the ability of a site to track a user, as the site would then only be able to track the user across multiple sessions when they authenticate with the site itself (e.g. by making a purchase or logging in to a service).

However, this also reduces the usefulness of the API as a long-term storage mechanism. It can also put the user's data at risk, if the user does not fully understand the implications of data expiration.

Treating persistent storage as cookies

If users attempt to protect their privacy by clearing cookies without also clearing data stored in the local storage area, sites can defeat those attempts by using the two features as redundant backup for each other. User agents should present the interfaces for clearing these in a way that helps users to understand this possibility and enables them to delete data in all persistent storage features simultaneously. [COOKIES]

Site-specific safelisting of access to local storage areas

User agents may allow sites to access session storage areas in an unrestricted manner, but require the user to authorize access to local storage areas.

Origin-tracking of stored data

User agents may record the origins of sites that contained content from third-party origins that caused data to be stored.

If this information is then used to present the view of data currently in persistent storage, it would allow the user to make informed decisions about which parts of the persistent storage to prune. Combined with a blocklist ("delete this data and prevent this domain from ever storing data again"), the user can restrict the use of persistent storage to sites that they trust.

Shared blocklists

User agents may allow users to share their persistent storage domain blocklists.

This would allow communities to act together to protect their privacy.

While these suggestions prevent trivial use of this API for user tracking, they do not block it altogether. Within a single domain, a site can continue to track the user during a session, and can then pass all this information to the third party along with any identifying information (names, credit card numbers, addresses) obtained by the site. If a third party cooperates with multiple sites to obtain such information, a profile can still be created.

However, user tracking is to some extent possible even with no cooperation from the user agent whatsoever, for instance by using session identifiers in URLs, a technique already commonly used for innocuous purposes but easily repurposed for user tracking (even retroactively). This information can then be shared with other sites, using visitors' IP addresses and other user-specific data (e.g. user-agent headers and configuration settings) to combine separate sessions into coherent user profiles.

12.3.2 Sensitivity of data

User agents should treat persistently stored data as potentially sensitive; it's quite possible for emails, calendar appointments, health records, or other confidential documents to be stored in this mechanism.

To this end, user agents should ensure that when deleting data, it is promptly deleted from the underlying storage.

12.4 Security

12.4.1 DNS spoofing attacks

Because of the potential for DNS spoofing attacks, one cannot guarantee that a host claiming to be in a certain domain really is from that domain. To mitigate this, pages can use TLS. Pages using TLS can be sure that only the user, software working on behalf of the user, and other pages using TLS that have certificates identifying them as being from the same domain, can access their storage areas.

12.4.2 Cross-directory attacks

Different authors sharing one host name, for example users hosting content on the now defunct geocities.com, all share one local storage object. There is no feature to restrict the access by pathname. Authors on shared hosts are therefore urged to avoid using these features, as it would be trivial for other authors to read the data and overwrite it.

Even if a path-restriction feature was made available, the usual DOM scripting security model would make it trivial to bypass this protection and access the data from any path.

12.4.3 Implementation risks

The two primary risks when implementing these persistent storage features are letting hostile sites read information from other domains, and letting hostile sites write information that is then read from other domains.

Letting third-party sites read data that is not supposed to be read from their domain causes information leakage. For example, a user's shopping wishlist on one domain could be used by another domain for targeted advertising; or a user's work-in-progress confidential documents stored by a word-processing site could be examined by the site of a competing company.

Letting third-party sites write data to the persistent storage of other domains can result in information spoofing, which is equally dangerous. For example, a hostile site could add items to a user's wishlist; or a hostile site could set a user's session identifier to a known ID that the hostile site can then use to track the user's actions on the victim site.

Thus, strictly following the origin model described in this specification is important for user security.

百度