前端在本地,調試,就經常的就是會遇到 調用接口,提示跨域了。
如你要訪問 http://****/api/user
chrome 瀏覽器 報錯:
XMLHttpRequest cannot load http://****/api/user No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
在谷歌中實現數據跨域,其實,處理下很簡單,在屬性中加入一個值 --disable-web-security --user-data-dir , 前面有空格哈
效果如下圖
Tips: 不要把chrome瀏覽器固定在 桌面最下方的任務欄里 , 至於原因,你固定試下就知道了...
很爽的說