妄徒之命 2014-08-21 04:36 采纳率: 100%
浏览 68

带有jQuery.ajax()的CORS

Firefox seems to be preventing this request, while Chrome is processing it fine. What am I doing wrong?

http://jsfiddle.net/e8qu2g9j/1/

$.ajax({
    url: "http://maps.googleapis.com/maps/api/geocode/json",
    data: {
        bounds: "-35.2545,149.4947|-31.9955,152.5728",
        region: "au",
        components: "country:AU|administrative_area:NSW",
        address: "Central Station"
    }
});

I've tried adding:

crossDomain: true,
xhrFields: {
    mozAnon: true,
    mozSystem: true
},

but to no avail.

Firefox 31.0 keeps giving me:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://maps.googleapis.com/maps/api/geocode/json?bounds=-35.2545%2C149.4947%7C-31.9955%2C152.5728&region=au&components=country%3AAU%7Cadministrative_area%3ANSW&address=Central+Station. This can be fixed by moving the resource to the same domain or enabling CORS.

EDIT: This is working fine for me in a new firefox profile, but not my main one. What setting could I have changed?

  • 写回答

1条回答 默认 最新

  • weixin_33733810 2014-08-21 05:34
    关注

    Disable the HTTPS everywhere plugin.

    https://bugzilla.mozilla.org/show_bug.cgi?id=692843

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?