超时AJAX请求科尔多瓦5 [英] Timeout AJAX Requests Cordova 5

查看:96
本文介绍了超时AJAX请求科尔多瓦5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

previously工作cordva项目不再能够通过AJAX的设备上运行,虽然同code工作在纹波仿真器时检索数据。我用空的错误消息出来立即加入科尔多瓦 - 插件白名单和现在要求的时间。有没有其他事情做?

Previously working cordva project no longer able to retrieve data via AJAX when running on a device though same code works in the Ripple emulator. I added cordova-plugin-whitelist and now the requests time out immediately with empty error message. Is there something else to do?

推荐答案

另一种方法是这样的速战速决&ndash的;但要知道,这的速战速决的删除所有需求白名单。这将创建,你可能不会被传递希望在安全问题。

The fix to many common white-list problems

The alternative is this quick fix – but know that this quick fix removes all needs for white-list. This creates a security issue which you may not want to by pass.

速战速决添加到您的的config.xml 的PhoneGap只建
< preference名=PhoneGap的版本值=3.7.0/>

QUICK FIX Add this to your config.xml for PHONEGAP BUILD ONLY
<preference name="phonegap-version" value="3.7.0" />

长的答案是这样:

热门误判开发新科尔多瓦/ PhoneGap的你已经一:

  • #6 不设置的PhoneGap版为你的编译器
  • #7的未设置版为你插件
  • #10 不增加新的白名单和白名单插件config.xml中的参数。
  • #6 Not setting the "phonegap version" for your compiler
  • #7 Not setting "version" for you plugins
  • #10 Not adding the new "white-list" and "white-list plugin" parameters in config.xml.

有关#6安培; #7

For #6 & #7

通过CLI版本,如果你不为你的平台,或在''的PhoneGap构建''如果你不设置的PhoneGap版本config.xml中,您将获得最新的版本分配一个版本。如果你够幸运,你的程序仅仅按预期工作。如果你不走运,你会得到一组级联的错误。

With the CLI version, if you do not assign a version for your platform OR in ''Phonegap Build'' if you do not set the phonegap-version in config.xml, YOU WILL GET THE LATEST VERSION. If you are lucky, your program just works as expected. If you are not lucky, you'll get a set of cascading errors.

幸运的是,我们所有的人,冬青Schinsky提供写一篇好的博客贴子来解释这一切:

Luckily for all of us, Holly Schinsky has written a nice blog post to explain it all:

科尔多瓦/ PhoneGap的版本混乱
   http://devgirl.org/2014/11/07/cordovaphonegap-version-混乱/

Cordova/PhoneGap Version Confusion
http://devgirl.org/2014/11/07/cordovaphonegap-version-confusion/

有关#10

此相对*新*要求意味着&ndash的;访问任何网站或资源,在网络上,则必须使用白名单和白名单的插件。此要求进入的影响,如果你使用的是cordova-android@4.0.0或更好;包括CLI-5.1.1和CLI-5.2.0。但是,如果你的版本是4.0.0之前,让我们说3.5.0或3.7.0,那么你会的没有的必须添加的白名单的要求。

This relatively * NEW * requirement means – to access ANY website or resources on the web, you MUST use the whitelist and the whitelist plugin. This requirement goes into affect, if you are using cordova-android@4.0.0 or better; including cli-5.1.1 and cli-5.2.0. If however, your version is before 4.0.0, let's say 3.5.0 or 3.7.0, then you will not have to add the white-list requirement.

需要明确的是,在白名单已经出现了一点,但这个插件和要求是非常新的。正如你所期望的,白名单中添加的时候,事实上的开放式访问功能是pcated德$ P $。或者说另一种方式,事实上的开放式访问功能,计划和预定被淘汰。这种变化标志着去除开放式访问功能的步骤。

To be clear, the "whitelist" has been around for a bit, but the plugin and requirement is very new. As you would expect, when the "whitelist" was added, the defacto open-access feature was deprecated. Or said another way, the defacto open-access feature was planned and scheduled to be eliminated. This change marks a step in removal of the open-access feature.

在此外,内容安全策略(CSP)已经引起许多开发者 - 因为它被SOOOO公布很差。 根据您的使用和PhoneGap的你正在使用的版本,在CSP需要去您使用的每一个HTML页面,就像你必须等待'deviceready。但是,也有在那里它不需要在所有的情况下。是混淆了一些文件,请仔细阅读。该文档被埋没在众多的最新文档页面的底部。

In addition, the Content Security Policy (CSP) has caught numerous developers - because it was soooo poorly publicized. Depending on your use and the version of Phonegap you are using, the CSP needs to go in every single HTML page you used, just like you have to wait for 'deviceready'. However, there are cases where it is not needed at all. The documentation is confusing for some, please read it carefully. The documentation is buried in the bottom of many of the latest documentation pages.

相关链接

的PhoneGap构建论坛:的注意升级到CLI-5.1.1上PGB 现在需要白名单

Phonegap Build Forum: Notes for upgrading to cli-5.1.1 on PGB and now required Whitelist

  • Cordova Whitelist Guide
  • Phonegap Whitelist Guide
  • Phonegap Build Whitelist Guide

这篇关于超时AJAX请求科尔多瓦5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆