我正在嘗試提出一個簡單的跨域請求,而Firefox始終通過此錯誤阻止它:跨域請求被阻止:同源策略禁止讀取[url]處的遠程資源??梢酝ㄟ^將資源移到同一域或啟用CORS來解決此問題。[網(wǎng)址]它可以在Chrome和Safari中正常運行。據(jù)我所知,我已經(jīng)在PHP上設置了所有正確的標頭,以使其能夠正常工作。這是我的服務器響應的內容HTTP/1.1 200 OKDate: Mon, 23 Jun 2014 17:15:20 GMTServer: Apache/2.2.22 (Debian)X-Powered-By: PHP/5.4.4-14+deb7u8Access-Control-Allow-Origin: *Access-Control-Allow-Methods: GET, POST, OPTIONSAccess-Control-Allow-Headers: Content-TypeAccess-Control-Request-Headers: X-Requested-With, accept, content-typeVary: Accept-EncodingContent-Length: 186Content-Type: text/html我嘗試使用Angular,jQuery和基本的XMLHTTPRequest對象,如下所示:var data = "id=1234"var request = new XMLHttpRequest({mozSystem: true})request.onload = onSuccess;request.open('GET', 'https://myurl.com' + '?' + data, true)request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')request.send()...并且適用于除Firefox之外的所有瀏覽器。有人能幫忙嗎?
Firefox盡管標頭出現(xiàn)“跨域請求被阻止”
慕斯709654
2019-12-18 16:37:49