function getSystemInfoFromApp(){
var u = navigator.userAgent,
app = navigator.appVersion;
var data = null;
var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //android终端或者uc浏览器
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
if (isAndroid) {
if (window.android) {
console.log('进入安卓')
data = window.android.方法名();
}
} else if (isiOS) {
if (window.webkit) {
//调用IOS的jumpjumpNext()方法
data = window.webkit.messageHandlers.方法名.postMessage(null);
}
}
return data
}
js 与安卓和ios交互
最新推荐文章于 2024-05-11 01:35:16 发布