[英]iframe same origin policy issue
I am getting following error ,when trying to read iframe content whose src is other domain 我在尝试读取其src是其他域的iframe内容时遇到以下错误
SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "https://qa-xxx.abc.com" from accessing a frame with origin "https://yyy.abc.com". Protocols, domains, and ports must match.
Now Suppose right now i am in https://qa-xxx.abc.com doamin and my iframe code is 现在假设我现在在https://qa-xxx.abc.com doamin和我的iframe代码是
<iframe src="https://yyy.abc.com" style="height: 100%; width: 105%;" id="id_description_iframe"></iframe>
while searching i found this solution Access-Control-Allow-Origin not working for iframe withing the same domain 在搜索时我发现这个解决方案Access-Control-Allow-Origin不适用于具有相同域的iframe
So i did like that document.domain = 'abc.com'
所以我确实喜欢那个
document.domain = 'abc.com'
Still same Issue,Any Solution will be Helpfull. 仍然是相同的问题,任何解决方案都将是有用的。
You're violating Same Origin Policy. 您违反了同源政策。 Add:
document.domain = abc.com
to both of the pages. 在两个页面中添加:
document.domain = abc.com
。 Either directly in a script tag, or in a referenced js file. 直接在脚本标记中或在引用的js文件中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.