javascript “协议、域和端口必须匹配”问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16879538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 06:20:03  来源:igfitidea点击:

"Protocols, domains, and ports must match" problems

javascriptfacebookadsense

提问by Ewe Tek Min

My website have these error messages when i view it on console. Can anybody tell me what is the problems that usually caused these error messages?

当我在控制台上查看时,我的网站有这些错误消息。谁能告诉我通常导致这些错误消息的问题是什么?

Blocked a frame with origin "mysite" from accessing a frame with origin "facebook". The frame being accessed set "document.domain" to "facebook", but the frame requesting access did not. Both must set "document.domain" to the same value to allow access. contentscript_siteoverlay_bin.js:78

Blocked a frame with origin "mysite" from accessing a frame with origin "youtube". Protocols, domains, and ports must match. contentscript_siteoverlay_bin.js:78

Blocked a frame with origin "mysite" from accessing a frame with origin "googleads". Protocols, domains, and ports must match. contentscript_siteoverlay_bin.js:78

Blocked a frame with origin "mysite" from accessing a frame with origin "facebook". The frame requesting access has a protocol of "http", the frame being accessed has a protocol of "https". Protocols must match.

阻止了来源为“mysite”的框架访问来源为“facebook”的框架。被访问的框架将“document.domain”设置为“facebook”,但请求访问的框架没有。两者都必须将“document.domain”设置为相同的值以允许访问。contentscript_siteoverlay_bin.js:78

阻止了来源为“mysite”的框架访问来源为“youtube”的框架。协议、域和端口必须匹配。contentscript_siteoverlay_bin.js:78

阻止了来源为“mysite”的框架访问来源为“googleads”的框架。协议、域和端口必须匹配。contentscript_siteoverlay_bin.js:78

阻止了来源为“mysite”的框架访问来源为“facebook”的框架。请求访问的帧具有“http”协议,被访问的帧具有“https”协议。协议必须匹配。

thank you for your help.

感谢您的帮助。

回答by Scott Selby

iframes and the main page have to match protocols ( Http://and Https://)

iframe 和主页必须匹配协议(Http://Https://

a secure site can not communicate with a not-secure site

安全站点无法与不安全站点通信

just make everything secure to make things easier. Sites like Facebook are going to require it anyways.

只是让一切安全,让事情变得更容易。无论如何,像 Facebook 这样的网站都会需要它。

回答by Ricardo Saraiva

Can you provide some information about the browser where you're getting those errors?

您能否提供一些有关出现这些错误的浏览器的信息?

Because Chromehave a know error related with your issue. More info here.

因为Chrome有一个与您的问题相关的已知错误。更多信息在这里

回答by oligofren

You cannot access values in the embedded facebook page. That is against the Same Domain Policy. The two sites can communicate using postMessage if you control both sites, but I doubt that you control the facebook part ...

您无法访问嵌入式 Facebook 页面中的值。这违反了相同域策略。如果您控制两个站点,这两个站点可以使用 postMessage 进行通信,但我怀疑您是否控制了 facebook 部分...