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>