h5开发安卓ios坑总结

1 ios 浏览器 如果是无痕模式,不支持本地缓存
 
2 ios new时间对象,需要用逗号隔开传日期的方式
 
 
3 ios个别版本对fixed的属性的支持性不好,需要用absolute替代
 
4 h5呼出键盘遮挡底部输入框问题:
var oHeight = $(document).height(); //浏览器当前的高度
$(window).resize(function(){
      if($(document).height() < oHeight){
              $("#footer").css("position","static");
      }else{
              $("#footer").css("position","absolute");
      }
 });
5 input 的 placeholder会出现文本位置偏上的时候
            input 的placeholder会出现文本位置偏上的情况:PC端设置line-height等于height能够对齐,而移动端仍然是偏上,解决是设置line-height:normal
6 zepto点透的解决方案
     a-用fastClick.js插件
     b-用touchend代替touch并阻止掉touchend的默认事件
     c-延迟300秒以上执行事件
7 在第三方浏览器打开H5页面,高度100%渲染问题
 
解决方法:
     在js里设置 document.documentElement.style.height = window.innerHeight + 'px';
 
8 css中active伪类效果不兼容问题
     在安卓4.0版本以下css:active伪状态效果无法兼容,需要给该元素的touch系列的事件绑定一个空匿名方法:
     var element = document.getElementById("aaa");
     element.addEventListener('touchstart',function(){},false);
9 视频音频的预加载,自动播放
     
 
自动播放的有效性受操作系统,浏览器,版本等影响,苹果官方规定必须由用户手动触发才会载入音频,那么我们捕捉一次用户操作后,让音频播放
doucment.addEventListerner('touchstart',function(){
        document.getElementsByTagName('audio')[0].play();
})
 
原文地址:https://www.cnblogs.com/solaZhan/p/8258945.html