"跨域请求封锁&QUOT ;.如何克服? [英] "Cross-origin-request blocked". How to overcome that?

查看:171
本文介绍了"跨域请求封锁&QUOT ;.如何克服?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用离子调用REST服务和angularJS它越来越跨起源请求封杀。如何克服的?

感谢您。

最好添加<一个href=\"https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en\" rel=\"nofollow\">https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en你的浏览器扩展程序。


解决方案

 &LT; cfheader NAME =访问控制允许来源VALUE =*&GT;
&LT; cfheader NAME =Content-Type的VALUE =文/ JavaScript的&GT;

您将设置你的服务器页面,这意味着你想从远程访问的页面上上面的文字。还有一件事,我使用的ColdFusion服务器,以便上述code看起来比照code格式。所以,你会改变你的语法使用有哪些服务器。

When I am calling rest services using ionic and angularJS It's getting "Cross-origin-request blocked". How to overcome that?

Thank you.

Better to Add https://chrome.google.com/webstore/detail/allow-control-allow-origi/nlfbmbojpeacfghkpbjhddihlkkiljbi?hl=en to your chrome extension.

解决方案

<cfheader name="Access-Control-Allow-Origin" value="*">
<cfheader name="Content-Type" value="text/javascript">

You will set above text on your server page that means which page you want access from remote. And one more thing i am using coldfusion server so above code looks in cf code format. So you will change syntax which server you have use.

这篇关于&QUOT;跨域请求封锁&QUOT ;.如何克服?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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