Read IFrame cookie

旧巷老猫 提交于 2019-12-12 14:19:19

问题


I created an iframe and I loaded a website in it ( i dont have access to this website - it wasnt written by me)

<script type="text/javascript">

  var el = document.createElement("iframe");
  el.setAttribute('id', 'ifrm');
  document.body.appendChild(el);
  el.setAttribute('src', 'http://AWEBSITE.com/');
  alert(document.getElement("iframe").cookie); //This doesnt work.....
</script>

Can I use javascript in some way to read my cookies of the iframe?


回答1:


It is impossible because of the same origin policy. Do you really want someone to be able to stick an iframe on any page, point to any domain, and get your cookies?



来源:https://stackoverflow.com/questions/15817957/read-iframe-cookie

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!