How Ajax call is working in mobile app (PhoneGap), but not in PC browser?

前端 未结 4 1386
伪装坚强ぢ
伪装坚强ぢ 2020-12-10 06:47

How Ajax call to server page works prefect in mobile app (using PhoneGap). But, When I run the same Ajax call from normal HTML page in PC browser it is not working. I guess

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-10 07:43

    Mobile applications (PhoneGap, Adobe AIR, Titanium, Native, etc) do not have the same-origin restriction for XHR requests that desktop browsers do. They can make any cross-domain calls that they want. That is why it works fine on the phone and not on the desktop.

    JSONP works fine in both because it does not use XHR. It does a cross-domain request by use the

提交回复
热议问题