访问属性“文档”的权限被拒绝 [英] Permission denied to access property 'document'

查看:307
本文介绍了访问属性“文档”的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在那里使用以下脚本,在我的页面上添加iframe形成这个脚本,我想获得iframe html。

I am using following script there, form this script on my page add iframe and I want to get iframe html.

<script src="http://ads.sonobi.com/ttj?id=881134" type="text/javascript"></script> 

问题在iframe有内部iframe。

Problem is in iframe there is inner iframe.

Javascript以下函数用于获取ifrmae的内容

Javascript following function using for get content of ifrmae

document.getElementById('f1').contentWindow.document.body.innerHTML 

当我运行时,这将显示以下错误

When I run this will show following error

Permission denied to access property 'document'

如何解决许可被拒绝的问题。

How to solve the problem of permission denied.

推荐答案

你不能。

为什么?这是一种阻止跨站点脚本(XSS)攻击的安全功能。

Why? It's a security feature to stop Cross-Site Scripting (XSS) attacks.

例如,您有一个加载 www.facebook.com 的iframe。如果未实现此安全功能,您可以轻松地从该站点获取数据。从Cookie到页面上的内容。

For example, you have an iframe that loads www.facebook.com. If this security feature wasn't implemented, you could easily fetch data from that site. From cookies, to what content is on the page.

这里有更多有用的信息: http ://www.veracode.com/security/xss

There is more helpful information about this here: http://www.veracode.com/security/xss

这篇关于访问属性“文档”的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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