【问题标题】:Are 'POST' cross domains ajax requests allowed in PhoneGap / jQuery Mobile apps?PhoneGap / jQuery Mobile 应用程序中是否允许“POST”跨域 ajax 请求?
【发布时间】:2012-05-04 18:32:24
【问题描述】:

如标题所示:PhoneGap / jQuery Mobile 应用程序在 webview 模式下是否允许“POST”跨域 ajax 请求?前提是 $.mobile.allowCrossDomainPages$.support.cors 都设置为 true。

【问题讨论】:

    标签: ajax jquery-mobile cordova webview


    【解决方案1】:

    这两个你都不需要。

    如果您在 iOS 中,只需添加一个新的外部主机并将其值设置为 *

    如果您使用的是 Android,请将其添加到您的清单中

    <access origin="https://example.com" subdomains="true" />
    

    这是关于同一主题的另一篇文章 - What is the state of whitelisting in phonegap 1.3.0?

    【讨论】:

    • 如果它只是一个 jQuery Mobile 应用程序,你知道该怎么做吗?
    • @FranciscoCorrales 这适用于所有方面。如果你做了一个捕获所有白名单 * 那么你就准备好了,一切顺利。由于应用程序位于沙盒中,因此跨域不是问题。
    【解决方案2】:
    jQuery.support.cors = true;
    

    也试试这个

    【讨论】:

      猜你喜欢
      • 2012-11-03
      • 1970-01-01
      • 2016-03-03
      • 2014-11-02
      • 2017-02-02
      • 2013-09-10
      • 1970-01-01
      • 2012-04-15
      • 1970-01-01
      相关资源
      最近更新 更多