具有内容的iFrame如何具有未定义的contentDocument对象? [英] How can an iFrame that has content, have an undefined contentDocument object?

查看:588
本文介绍了具有内容的iFrame如何具有未定义的contentDocument对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图开发一个浏览器扩展,它需要将事件处理程序注入到页面上的所有iFrame中。我发现一些iFrames与用于Disqus评论系统的iFrames有内容但没有contentDocument。



这是如何实现的,以及如何访问不带contentDocument的iframe的事件处理程序?



查看页面底部的注释部分,查看示例。如果您检查注释文本区域,则会看到它位于没有contentDocument的iFrame中。 nofollow>同源政策


I've been trying to develop a browser extension that needs to inject event handlers into all iFrames on a page. I have found that some iFrames, like those used for the Disqus commenting system, have content but no contentDocument.

How is this possible, and how can I access the event handlers for an iframe without a contentDocument?

Check out the comment section at the bottom of this page for an example. If you inspect the comment text area, you will see it is in an iFrame that has no contentDocument.

解决方案

This is caused by Same-Origin policy

这篇关于具有内容的iFrame如何具有未定义的contentDocument对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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