未捕获的安全错误:无法从“HTMLIFrameElement"读取“contentDocument"属性 [英] Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement'

查看:29
本文介绍了未捕获的安全错误:无法从“HTMLIFrameElement"读取“contentDocument"属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试针对特定需求制作自己的网站检查器",但在访问 iFrame 时遇到问题..

i'm trying to make my own "website checker" for specific needs and i'm having problem accessing the iFrame..

未捕获的安全错误:无法读取contentDocument"属性来自HTMLIFrameElement":阻止了一个原点为http://"的框架checker.xcore.co.il" 来自访问源为http://"的框架xcore.co.il".请求访问的框架将document.domain"设置为checker.xcore.co.il",但被访问的框架没有.两者都必须将document.domain"设置为相同的值以允许访问.

Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http:// checker.xcore.co.il" from accessing a frame with origin "http:// xcore.co.il". The frame requesting access set "document.domain" to "checker.xcore.co.il", but the frame being accessed did not. Both must set "document.domain" to the same value to allow access.

我必须使用 iFrame 执行此操作,因为我需要访问 CSS 类.点击此链接,加载网站,然后点击右侧的fontSizeErrors"然后你可以在控制台日志中看到错误.

I must do this using iFrame because i need to access classes CSS. Click on this link, load the website and then click "fontSizeErrors" on the right and then you can see the error in the console log.

请问我怎么通过这个??我在 Google 上找不到任何有用的东西..

How can i pass this please?? I couldn't find anything helpful on Google..

谢谢!

推荐答案

这是所有浏览器都使用的正常安全措施.您不能访问具有不同来源的元素或框架,这将是一个巨大的安全漏洞.因此,浏览器会阻止所有尝试执行此类操作的脚本.要在框架内执行任何操作,其内容必须具有相同的来源.

That's a normal security measure used by all the browsers. You can't access elements or frames that have a different origin, that would be a huge security flaw. Hence, the browser blocks all the scripts that try to do that kind of stuff. To perform any action inside a frame its content must have the same origin.

更多信息看看我的这个答案.

这篇关于未捕获的安全错误:无法从“HTMLIFrameElement"读取“contentDocument"属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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