控制台显示Uncaught SecurityError [英] Console displays Uncaught SecurityError
问题描述
我不确定如何解决以下错误。有人可以帮助我吗?
I'm not sure how I can fix the error below. Can somebody help me out?
未捕获的SecurityError:无法从'HTMLIFrameElement'读取'contentDocument'属性:阻止了一个原点为http的帧://mysite.net从访问具有原点的框架https://www.youtube.com。请求访问的帧具有http协议,被访问的帧具有https协议。协议必须匹配。
推荐答案
您正在尝试从http网站内访问https网址。 HTTPS和HTTP是不同的协议,导致不匹配。
You are trying to access an https url from within a http website. HTTPS and HTTP are different protocol and is causing a mismatch.
我认为以下链接可能有所帮助:
https://productforums.google.com/forum/#!topic/chrome/ODpydGiCgiE
I think the following link might help: https://productforums.google.com/forum/#!topic/chrome/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标题。
Or if you are just trying to access your own domain with different protocol, you can also try setting the Access-Control-Allow-Origin header.
Access-Control-Allow-Origin标头如何工作?
这篇关于控制台显示Uncaught SecurityError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!