ファイルがindex.html
でiframeが1セットあり、iframeソースが別のドメインを指しています。私はindex.html
でのlocalStorageを設定するとiframeソース内の値を取得しようとしています。(sample.html
)iframeにlocalstorageアイテムを取得
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
私はそれが可能ではないと思います。あるドメインでlocalstorageを設定し、それが私の知る限りではない別のドメインで取得することについて話していますか? – Akki619
設定と取得はブラウザによってローカルで行われます。場所やiframeの有無に関わらず。しかし、上のコードは、有効なHTMLではないことです。だから... –
@hakuna matata:[iframeタグ](http://www.w3schools.com/tags/tag_iframe.asp)と[localStorage](http:// www。 w3schools.com/html/html5_webstorage.asp)。 **その後**、[最小で完全で検証可能なコード](http://stackoverflow.com/help/mcve)に戻ってください。 –