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

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

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

 

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

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

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

 

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

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

 

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

posted @ 2016-08-11 16:26  ^^-^^-  阅读(469)  评论(0编辑  收藏  举报