小编Tim*_*ord的帖子

iframe ContentWindow

当我尝试从iframe中获取内容窗口时,使用

var contentWindow = document.getElementbyId('iframe').contentWindow 
Run Code Online (Sandbox Code Playgroud)

有时它返回"Window undefined",因为contentWindow不存在.我似乎无法使用它来检查它

if (contentWindow === unidentified) or if (contentWindow === null)
Run Code Online (Sandbox Code Playgroud)

因为如果我试图从中获取值,它只是代码中的错误.有没有其他人遇到这个问题,并找到了解决方案?

html javascript iframe html5 web

6
推荐指数
1
解决办法
2万
查看次数

标签 统计

html ×1

html5 ×1

iframe ×1

javascript ×1

web ×1