简体   繁体   中英

How to get value from multiple url localStorage

I want to get pointed url(row) localStorage value. Can I get this?

在此处输入图像描述

Short answer: You can access the local storage of https://branchbasics.referralcandy.com only if your JavaScript originates from that same server. This is a security measure of the browser implementation.

The browser stores are per origin, where "origin" is the same as for the Same Origin Policy (a combination of schema [http vs. https, etc.], port, and host). From web storage spec :

Each top-level browsing context has a unique set of session storage areas, one for each origin.

Thus, the storage for these examples are all different due to different origins:

  • http://example.com and http://foo.example.com and http://bar.example.com
  • http://example.com:80 and http://example.com:8080 and https://example.com

There is no mechanism built into web storage that allows one origin to access the storage of another.

Pages within the same origin can access the same storage, such as http://example.com/page1 and http://example.com/page2 both have access to the storage for http://example.com .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM