XMLHttpRequest to get HTTP response from remote host

前端 未结 4 2006
礼貌的吻别
礼貌的吻别 2021-01-02 06:24

Why the following code Based on Mozilla example does not work? Tried with Firefox 3.5.7 & Chrome.



        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-02 06:57

    You cannot make requests across domains, even with local files.

    https://developer.mozilla.org/en/Same_origin_policy_for_JavaScript

    Unless you are developing an extension, which does not have the same restrictions as a web page.

提交回复
热议问题