Open bbandydd opened 8 years ago
發問一下~我的平台是win8 + atom + Chrome,程式碼打好之後用File去開index.html,都會報錯,但開完live-server之後又都正常也能用File去開,會什麼會有這樣的問題??
錯誤:XMLHttpRequest cannot load file:xxx/.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.
@PSheon HTTPRequest 不支援 file:/// 的 URL,你還沒開啟 live-server 前他要去抓的那個檔案會無法從 http:// 的方式找到,所以他會嘗試用 file:/// 去找,因此就發生錯誤囉~
@mosluce 已經弄懂了~謝謝默司大大^_^
各位如果有問題,歡迎發問喔