一、基础概念
http://example.com
下的页面只能请求http://example.com
下的资源(假设端口相同)。二、相关优势
三、类型
Access - Control - Allow - Origin
等信息就可以正常获取数据。四、应用场景
五、常见问题及解决方法
Access - Control - Allow - Origin
设置为*
表示允许所有源访问,也可以设置为特定的源,如http://example.com
。<script>
标签没有跨域限制的特性。vue.config.js
(如果使用Vue.js)中:vue.config.js
(如果使用Vue.js)中:/api/some - endpoint
时,会被代理到http://another - origin.com/some - endpoint
,绕过浏览器的跨域限制。领取专属 10元无门槛券
手把手带您无忧上云