wendux / DSBridge-Android

:earth_americas: A modern cross-platform JavaScript bridge, through which you can invoke each other's functions synchronously or asynchronously between JavaScript and native.
3.73k stars 613 forks source link

targetSdkVersion 28 时 js里的ajax请求失败 #134

Closed is1988 closed 4 years ago

is1988 commented 5 years ago

我也不清楚为什么,当targetSdkVersion为28时,ajax的请求无论是post还是get都会直接失败,改成27时就正常了,是什么不兼容吗?

is1988 commented 5 years ago

jq的ajax直接返回的错误为{"readyState":0,"status":0,"statusText":"error"}

li-lance commented 5 years ago

你是不是http请求了

is1988 commented 5 years ago

你是不是http请求了

请问是什么意思,现在困扰我的问题是targetSdkVersion低于28,ajax没任何问题,高于就直接返回错误,连服务端都不会请求,不太明白您说的这句 是不是http请求了 是啥意思,不吝赐教。

li-lance commented 5 years ago

28以上限制明文接口传输所有的请都要走https,你可以再AndroidManifest.xml里通过设置android:usesCleartextTraffic="true" 把限制暂时关闭

is1988 commented 4 years ago

28以上限制明文接口传输所有的请都要走https,你可以再AndroidManifest.xml里通过设置android:usesCleartextTraffic="true" 把限制暂时关闭

nice啊 兄弟,就是这个问题 多谢 多谢,帮了大忙。