Win 解決Chrome瀏覽器跨域問(wèn)題
老版本Chrome瀏覽器(版本號(hào)49之前的跨域設(shè)置)
右鍵點(diǎn)擊谷歌瀏覽器,選擇屬性
-
在目標(biāo)輸入框尾部加上 --disable-web-security
注意:這里 --disable-web-security 前面有一個(gè)空格
image.png
3.點(diǎn)擊應(yīng)用和確定后關(guān)閉屬性頁(yè)面,并打開(kāi)chrome瀏覽器。如果瀏覽器出現(xiàn)提示“你使用的是不受支持的命令標(biāo)記 --disable-web-security”,那么說(shuō)明配置成功。
用命令行打開(kāi) Apple Safafi 方法: open -a '/Applications/Safari.app' --args --disable-web-security
Mac 解決Chrome瀏覽器跨域問(wèn)題
- 創(chuàng)建文件夾 MyChromeDevUserData(文件夾名稱可隨意配置)
- 創(chuàng)建 一個(gè)有語(yǔ)義的文件 chrome-debug.sh。 使用vim 打開(kāi)編輯 vim chrome-debug.sh
- 把下面代碼復(fù)制進(jìn)去 (xxx 是自己用戶名 切記要改;–user-data-dir= ‘第一步創(chuàng)建文件的本地路徑’ )
open -n /Applications/Google\ Chrome.app/ --args --disable-web-security --user-data-dir=/Users/xxx/Documents/MyChromeDevUserData
- 執(zhí)行一下命令,對(duì) chrome-debug.sh 文件進(jìn)行授權(quán)chmod 755 chrome-debug-enable.sh 755 所有者具有讀取、寫入、執(zhí)行權(quán)限
-
單擊右鍵,選擇terminal打開(kāi), 直接打開(kāi)跨域模式瀏覽器
如圖就是配置完成,可直接解決瀏覽器跨域
image.png
Ubuntu/Linux 解決Chrome瀏覽器跨域問(wèn)題:
chromium-browser --disable-web-security