阅读IFrame Cookie [英] Read IFrame cookie

查看:130
本文介绍了阅读IFrame Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个iframe,并在其中加载了一个网站(我无法访问此网站 - 它不是由我写的)

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>

我可以使用javascript以某种方式阅读iframe的Cookie吗?

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

推荐答案

这是不可能的,因为同源政策。你真的想让别人在任何网页上贴上iframe,指向任何网域,并取得Cookie吗?

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?

这篇关于阅读IFrame Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆