控制台显示Uncaught SecurityError

我不确定如何解决下面的错误。 有人可以帮帮我吗?

Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://mysite.net" from accessing a frame with origin "https://www.youtube.com". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.

您正尝试从http网站中访问httpsurl。 HTTPS和HTTP是不同的协议,导致不匹配。

我认为以下链接可能会有所帮助: https : //productforums.google.com/forum/#!topic /rome / ODPydGiCgiE

 if you want to access frames in a iframe you can change top with parent.frames only for accessing frames in the iframe who execute javascript. try to change top with parent.frames return top.frames; return parent.frames; in google chrome it work for me i can access all my frames in my iframe. 

或者,如果您只是尝试使用不同的协议访问自己的域,也可以尝试设置Access-Control-Allow-Origin标头。

Access-Control-Allow-Origin标头如何工作?

尝试使用//而不是在iFrame URL地址源地址中使用http://或https://指定协议。 它应该使用网站的协议。