无法使用 contentDocument 获取 iframe 元素

Cannot get the iframe element using contentDocument

未捕获的安全错误:无法从 'HTMLIFrameElement' 读取 'contentDocument' 属性:阻止了来源为“http://www.example.com" from accessing a frame with origin "https://www.youtube.com”的帧。协议、域和端口必须匹配。

您能在浏览器上看到相同的 YouTube 视频吗??? 如果不是,则说明您的浏览器设置有问题。或者,如果您在任何组织机器上执行此操作,那么 URL 可能会被阻止.... 你能 post 一段代码看看你是如何添加视频的吗 link??