localStorage可以完全取代第三方cookie吗?

时间:2013-12-16 21:24:47

标签: javascript html5 security local-storage

Safari by default blocks third-party cookies dropped with iframes

以同样的方式用localStorage简单地替换该功能有什么不利之处,它似乎没有阻止?对于不存在cookie的localStorage是否有任何限制?

<!-- filename localstorage.php -->
<script type="text/javascript">

    if (window.localStorage !== "undefined"){

        window.localStorage.user_id = "thomas123";

    }

</script>




<!-- filename call_localstorage.php -->
<iframe src="http://jsbin.com/UpelOcU/1/" width=1 height=1 border=0></iframe>

<script tyle="text/javascript">

    document.write(JSON.stringify(localStorage)); //{"user_id":"thomas123"}

</script>

0 个答案:

没有答案