移动端网页 -- 安卓与IOS兼容

时间:2022-06-17 05:58:08

1、在a链接长按时,ios系统会识别并复制a链接中的href值,而安卓不会,只会选择复制文字

  关于长按复制其他区域内容:pc端可以实现,在移动端目前还没有找到解决方案,很多都是基于flash的

2、input框聚焦时,键盘向上突出,ios把键盘当做页面的一部分,而安卓页面高度不包含该部分

  解决方案:js中判断系统类型,将页面的高度设置为设备的高度

 $(function(){
//ios与安卓的对比,页脚固定
var ua = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(ua)) {
//alert("1")
} else if (/android/.test(ua)) {
var height = document.body.clientHeight;
$('body').css('height',''+height+'');
}
})

3、本地缓存时,安卓系统需要设置一个属性支持localStoage:settings.setDomStorageEnabled(true)

可以参考http://*.com/questions/5899087/android-webview-localstorage

4、flex布局,目前android4.4以上才支持