如何解决跨域问题? [英] How Can I Solve Cross Domain Issue?

查看:66
本文介绍了如何解决跨域问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想访问For Ex。 www.websit1.com 从我的www.website2.com作为我网站上的子页面。



我的代码在html页面中访问website2中的website1



赞:



Hi,

I want to access For Ex. www.websit1.com from my www.website2.com as a child page in my website2.

Below my code in html page for access website1 in website2

Like:

<html>
<head></head>
<body>
<iframe id="Frame" src="www.website2.com" name="Frame" allowtransparency="true" frameborder="0" style="width:100%;height:500px"></iframe>
</body>
</html>





但我收到的错误如



Uncaught SecurityError:阻止原始www.website2.com的框架访问具有原点www.website1.com的框架。协议,域名和端口必须匹配。



如何解决此错误???



请分享任何建议或答案。



谢谢,



But i get the error like

Uncaught SecurityError: Blocked a frame with origin "www.website2.com" from accessing a frame with origin "www.website1.com". Protocols, domains, and ports must match.

How can solve this error???

Please share any suggestion or answer.

Thanks,

推荐答案

这是一个浏览器设置,所以你会需要对浏览器进行更改。你无法通过代码控制它。
That is a browser setting so you'll need to make the change to the browser. You can't control it through code.


这篇关于如何解决跨域问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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