如果在Cordova应用中未加载jQuery Mobile,则XmlHttpRequest无法正常工作

我正在使用Cordova,jQuery和jQuery mobile开发iOS和Android应用程序。不幸的是,由于jQuery mobile需要jQuery 1.12.4中的漏洞,Google拒绝了我的应用程序。因此,我决定删除jQuery mobile并仅使用jQuery 3.4.1(该漏洞也包含该漏洞,但可以轻松对其进行修补)。

$。ajax在没有jQuery mobile的情况下无法工作。因此,我开始使用旧的XmlHttpRequest()调用进行测试,但这也失败了。我的应用程序的状态为readyState 4(完成),但状态为0,实际上没有对服务器的调用(访问日志文件中没有日志条目)。

我搜索了一个解决方案,它看起来像一个安全限制。但是,无论我尝试了什么,仍然没有运气。

这是我的代码(片段):

appServer = "http://sdb.rls.trippler.nl";
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = loginHandler;
xmlHttp.open("POST",appServer,true);
xmlHttp.send(fd);

我有此内容安全政策:

<meta http-equiv="Content-security-policy" content="
             img-src * blob: android-webview-video-poster: cdvphotolibrary: 'self' data: 'unsafe-inline' 'unsafe-eval';
             default-src * blob: 'self' gap: wss: ws: data:;
             style-src 'self' 'unsafe-inline';
             script-src 'self' 'unsafe-inline' 'unsafe-eval';
             connect-src * http: https: ws: wss:;">

这是在我的config.xml文件中:

<content src="index.html" />
<access origin="http://sdb.rls.trippler.nl" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="ios">
    <access origin='*' allows-arbitrary-loads-for-media='true' allows-arbitrary-loads-in-web-content='true' allows-local-networking='true' />
    <allow-intent href="itms:*" />
    <allow-intent href="itms-apps:*" />
</platform>
<plugin name="cordova-plugin-whitelist" spec="1" />

任何人都可以给我提示我缺少或做错了什么吗?一旦我包含jQuery mobile,此代码就会起作用,因此它必须是一些(简单的)设置。...?

感谢您阅读和回答我的问题, 问候罗兰

a283133294 回答:如果在Cordova应用中未加载jQuery Mobile,则XmlHttpRequest无法正常工作

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3094031.html

大家都在问