客户端从localhost:8880从localhost:8880调用服务器,但获取跨源请求仅被支持 [英] client from localhost:8880 calls server from localhost:8880 but gets Cross origin requests are only supported

查看:471
本文介绍了客户端从localhost:8880从localhost:8880调用服务器,但获取跨源请求仅被支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个html页面与angular2 on url:

I have an html page with angular2 on url:

http:// localhost:8880 / SupporTool / html / angular2 / index。 html#

localhost :8880 / SupporTool / Push / SelectMessagesAttributes

如何获得

code>只支持跨源请求..

Cross origin requests are only supported..

推荐答案

必须在Chrome中停用同源策略。

one has to disable same origin policy in Chrome. It blocks all calls from localhost to itself.

使用 - disable-web-security 标志启动chrome

start chrome with the --disable-web-security flag

这篇关于客户端从localhost:8880从localhost:8880调用服务器,但获取跨源请求仅被支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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