亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么這個api不會產生跨域?

為什么這個api不會產生跨域?

收到一只叮咚 2018-10-24 11:06:49
這個測試項目沒有做跨域處理 為什么第一個api能獲取到數據 而第二個api就會產生跨域呢 提示No 'Access-Control-Allow-Origin' header is present on the requested resource. 這是為什么?<template>    <div class="txt">    </div></template><script>export default {  name: 'Test2',   mounted () {    this.$http.get('http://api.komavideo.com/news/list').then(res => {      console.log(res)     })   } }</script><style scoped></style><template>    <div class="txt">    </div></template><script>export default {  name: 'Test2',   mounted () {    this.$http.get('http://api.douban.com/v2/movie/in_theaters').then(res => {      console.log(res)     })   } }</script><style scoped></style>
查看完整描述

1 回答

?
慕哥9229398

TA貢獻1877條經驗 獲得超6個贊

因為在XHR2中,只要被調用站允許跨站訪問,就不會被攔截。默認情況下不開啟。

查看完整回答
反對 回復 2018-10-24
  • 1 回答
  • 0 關注
  • 953 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號