如何使用相对URL在Android 4.4(KitKat)的trigger.io应用程序中的Ajax请求? [英] How can I use relative urls in ajax requests within trigger.io apps on Android 4.4 (kitkat)?

查看:285
本文介绍了如何使用相对URL在Android 4.4(KitKat)的trigger.io应用程序中的Ajax请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我trigger.io捆绑的jQuery移动应用程序适用于这两个Android和LT很大; 4.4和iOS设备,但拒绝加载任何相对的页面,在Android 4.4一旦jQuery Mobile的加载脚本等。据我所知,JQM变成各个环节Ajax请求,这表明Ajax请求都断了。 WebView中已改为30铬为基础的奇巧和迁移指南中提到的URL处理为重大更改的区域(下面第二个链接)。

My trigger.io-bundled jquery-mobile app works great on both android < 4.4 and iOS devices but refuses to load any relative pages, scripts etc. on android 4.4 once jquery mobile loads. Afaik, jqm turns all links to ajax requests, which suggests ajax requests are broken. WebView has been changed to be Chromium 30-based in kitkat and the migration guide mentions url handling as an area of breaking changes (second link below).

https://developer.android.com/about/versions/android- 4.4.html
https://developer.android.com/guide/webapps/migrating.html#URLs

有至少一人带着一颗破碎的JQM / trigger.io应用中使用Android 4.4,看到的 https://github.com/jquery/jquery-mobile/issues/6746 。我已经把一个小的应用程序,你可以用它来验证这个问题: https://github.com/mnacos/ JQM-奇巧

There is at least one other person with a broken jqm/trigger.io app on android 4.4, see https://github.com/jquery/jquery-mobile/issues/6746 . I have put together a small app you can use to verify the issue: https://github.com/mnacos/jqm-kitkat

我如何获得相对URL再次合作的Andr​​oid 4.4的Ajax请求?有没有办法建立trigger.io应用程序为Android 4.4(KitKat)的时候控制targetSdkVersion?有没有在trigger.io的WebView /浏览器定义的自定义方案可能相对链接帮助?

How do I get ajax requests working against relative urls again on android 4.4? Is there a way to control targetSdkVersion when building trigger.io apps for Android 4.4 (kitkat)? Is there a custom scheme defined in the trigger.io webview/browser which could help with relative links?

推荐答案

不幸的是Android 4.4系统的WebView网址规范化/规范化逻辑是非标准[A]计划了很多比较保守的。这是因为标准方案的正常化假设能更改URL为小写,做到%编码等..这将打破内容:// 网​​址的例子。如果你看看你链接的错误,好像这个问题的根本问题是JQM重写URL中内容://// 而不是内容://

Unfortunately the Android 4.4 WebView's URL canonicalization/normalization logic is a lot more conservative for non-standard[a] schemes. This is because the normalization of standard schemes assumes it can change the URL to lowercase, do %-encoding, etc.. which would break content:// URLs for example. If you look at the bug you've linked it seems like the root issue of the problem is jqm rewriting the urls to be content://// instead of content://.

我不认为这是有可能解决4斜线满足迫切修复了酒吧web视图(如果你不同意我们欢迎您就这个错误),所以恕我直言最好的(也可能是最快)的方式来解决这一问题将与JQM团队合作(或提交pull请求),使JQM没有额外的2斜线添加到URI。

I don't think it's likely resolving the 4 slashes meets the bar for an urgent fix in the WebView (you're welcome to file a bug on this if you disagree) so IMHO the best (and probably fastest) way to address this would be to work with the jqm team (or submit a pull request) to make jqm not add the extra 2 slashes to the URI.

[α]铬具有硬codeD标准方案的列表。这些包括HTTP,HTTPS,FTP等,它的本质上已知是与归一化算法兼容方案的列表

[a] Chromium has a list of hardcoded "standard" schemes. These include http, https, ftp, etc. and it's essentially a list of schemes known to be compatible with the normalization algorithm.

编辑:不幸的是改变targetSdkVersion不会帮助你在这种情况下

unfortunately changing the targetSdkVersion won't help you in this case.

这篇关于如何使用相对URL在Android 4.4(KitKat)的trigger.io应用程序中的Ajax请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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