1
我試圖從instagram獲取JSON文件,並且在製作$ http.get時出現錯誤:請求的資源上沒有'Access-Control-Allow-Origin'標頭 - 錯誤
insta.ctrl:
insta.controler 'instaCtrl' ($scope, $http), ->
$http.get('http://api.instagram.com/publicapi/oembed/?url=http://instagr.am/p/fA9uwTtkSN/')
.success(data), ->
#done !
.error(e), ->
#nah !
我的Apache2的conf對鉻
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
錯誤消息:
XMLHttpRequest cannot load #url_of_intagram_api_here. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.
它工作時,我禁用鉻在互聯網安全。 有什麼建議嗎?
重複的問題請參考:HTTP://stackoverflow.com/questions/20035101/no-access-control-allow-origin-header-is-present-on-the-requested-資源 –