Chrome屏蔽了不同的来源请求 [英] Chrome blocks different origin requests

查看:176
本文介绍了Chrome屏蔽了不同的来源请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当脚本尝试访问来自不同来源的框架时,Chrome将其屏蔽并引发异常:
$ b blockquote>

Uncaught SecurityError:来源'提供者域'访问源'mydomain'的框架,协议,域和端口必须匹配。

在google chrome中进行了一些更新后,我收到了此错误。任何建议?

解决方案

在框架和/或窗口之间的直接JavaScript调用只有符合同源策略。如果您的窗口和iframe共享一个共同的父域,您可以将 document.domain 设置为 domain lower )一个或两个,以便他们可以沟通。否则,您需要查看类似 postMessage()API 的内容。

When script tries to access a frame from a different origin Chrome blocks it and throws exception as

"Uncaught SecurityError: Blocked a frame with origin 'provider domain' from accessing a frame with origin 'mydomain'. Protocols, domains, and ports must match".

I got this error after some update in google chrome. Any suggestions?

解决方案

Direct Javascript calls between frames and/or windows are only allowed if they conform to the same-origin policy. If your window and iframe share a common parent domain you can set document.domain to "domain lower") one or both such that they can communicate. Otherwise you'll need to look into something like the postMessage() API.

这篇关于Chrome屏蔽了不同的来源请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆