小编hak*_*ata的帖子

获取 iframe 中的本地存储项

我有一个index.html包含一个 iframe 集的文件,并且 iframe 源指向另一个域。我正在设置 localstorageindex.html并尝试获取 iframe 源中的值。( sample.html)

File 1
index.html
    <html>
    <head>
    //js file 
    </head>
    <body>
    setting localstorage
    Iframe src="55.10.45.045/sample.html"
    </body>
    </html>

file 2
sample.html
       <html>
        <head>
        //js file 
        </head>
        <body>
        getting localstorage Item //Returns null
        </body>
        </html
Run Code Online (Sandbox Code Playgroud)

html javascript jquery local-storage

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

html ×1

javascript ×1

jquery ×1

local-storage ×1