相关疑难解决方法(0)

Chrome:获取iFrame并插入正文

我有以下代码在Firefox中正常工作...

if (!iFrame) iFrame = outerDoc.getElementById('_dialog_iframe');
var iFrameDoc = iFrame.contentWindow.document; // get iframe doc
Run Code Online (Sandbox Code Playgroud)

和Chrome版本......

if (!iFrame) iFrame = outerDoc.getElementById('_dialog_iframe');
var iFrameDoc = iFrame.document; // get iframe doc
Run Code Online (Sandbox Code Playgroud)

我正在测试代码,iFrameDoc.body当我在Firefox中运行FireFox代码时,它运行正常.但是,Chrome代码会返回undefined.为什么?如何解决这个问题,以便它在Chrome中运行良好?

javascript iframe google-chrome google-chrome-extension

3
推荐指数
1
解决办法
6916
查看次数