meta标签: 

H5页面窗口自动调整到设备宽度,并禁止用户缩放页面

<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />

忽略将页面中的数字识别为电话号码

<meta name="format-detection" content="telephone=no" />

忽略Android平台中对邮箱地址的识别

<meta name="format-detection" content="email=no" />

ios设备(不只iphone)中的safari私有meta标签,它表示:允许全屏模式浏览,开启对Web Aapp程序的支持

<meta content=”yes” name=”apple-mobile-web-app-capable” />

ios系统的私有标签,它指定在web app状态下,ios设备中顶端的状态条的颜色; 默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明)。若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)

<meta content=”black” name=”apple-mobile-web-app-status-bar-style” />

当网站添加到主屏幕快速启动方式,可隐藏地址栏,仅针对ios的safari

<meta name="apple-mobile-web-app-capable" content="yes" />

WebView 默认的样式:

body{
-webkit-text-size-adjust:none; /* 字型大小是不会变的,而使用者就无法透过缩放网页来达成放大字型*/
-webkit-appearance: none; /*可以改变按钮或者其它控件看起来类似本地的控件 */
-webkit-user-drag: none; /*-webkit-user-drag CSS 属性控制能否将元素作为一个整体拖动。*/
-webkit-user-select : none; /* 如果用户长按web网页的文本内容,都会出现选中的行为,提供复制文字等功能。禁止用户选中文字 for iOS */
}
a,button,input,textarea{
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); /*很多Android 浏览器的 a 链接有边框,这里取消它 transparent */
}
a, img{
-webkit-touch-callout:none; /* 在IOS浏览器里面,假如用户长按a标签,都会出现默认的弹出菜单事件。禁止用户在新窗口打开页面、如何禁止用户保存图片\复制图片 for iOS */
}

调用手机拨电话面板、短信面板、电子邮件

<a href="tel:18005555555">Call us at 1-800-555-5555</a>
<a href="sms:18005555555">
<a href="sms:18005555555,18005555556">
<a href="mailto:peun@foxmail.com">单击这里给peun发电子邮件</a>

调用时间

HTML5 拥有多个供选择日期和时间的新的输入类型:

  • date - 选择日、月、年
  • month - 选择月、年
  • week - 选择周、年
  • time - 选择时间(时、分)
  • datetime - 选择时间、日期、月、年(UTC 时间)
  • datetime-local - 选择时间、日期、月、年(本地时间)
<input type="date" name="user_date" />

调用颜色

<input type="color" name="user_color" />

检测是否已连网,以及网络速度

通用的

if (window.navigator.onLine) {
alert('online')
} else {
alert('offline');
}
// in IE 8 "online" and "ofline" events are raised on the document.body, under IE 9 - on both document.body and window
window.addEventListener("offline", function(e) {alert("offline");});
window.addEventListener("online", function(e) {alert("online");});

判断是否wifi网络

if (navigator.connection.type==navigator.connection.WIFI) {
// code for WiFi connections (high-bandwidth)
}

检测是否已联网,以及网络速度

function netDetect(){
//alert(window.navigator.userAgent);
var connection, connectionSpeed; // create a custom object if navigator.connection isn't available
connection = navigator.connection || {'type':'0'}; switch(connection.type){
case connection.ETHERNET:
case connection.WIFI:
connectionSpeed = 'highbandwidth';
break;
case connection.CELL_3G:
connectionSpeed = 'mediumbandwidth';
break;
case connection.CELL_2G:
connectionSpeed = 'lowbandwidth';
break;
case connection.UNKNOWN:
default:
connectionSpeed = 'noConnect';
} return connectionSpeed;
} function is_Android_Wifi(){
var connection = navigator.connection;
if(window.navigator.isAndroid && (connection.type == connection.ETHERNET || connection.type == connection.WIFI))
return true;
else return false;
}

隐藏IOS滚动条

self.tableView.showsVerticalScrollIndicator =NO;

对于需要适配各种移动设备,使用rem

funW();
$(window).resize(function(event) {
funW();
});
function funW(){
var winW = $(window).width();
var fontSize = $("html").css('font-size',winW/7.5);
}

拦截手机物理返回键,双击退出APP(AppCan)

 appcan.ready(function() {
var presstime=0;
uexWindow.setReportKey(0, 1);
uexWindow.onKeyPressed = function(keyCode) {
if (keyCode == 0) {
if(presstime==0){
uexWindow.toast("0", "5","再按一次返回键退出!", "3000");
presstime=1;
}else{
presstime=1;
uexWidgetOne.exit(0);
}
setTimeout(function() {
presstime=0;
}, 3000);
}
}
})

判断手机类型

//判断手机类型
var ua = navigator.userAgent.toLowerCase();
if (/iphone|ipad|ipod/.test(ua)) {
// 判断如果是iphone或者iPad则执行
if (/iphone|mac/i.test(navigator.userAgent)){
var html = "<div style='width:100%;height: 0.4rem;;background:#fff;position:fixed;top:0;'></div>";
$(".main_top").css('top', '0.4rem');
$(".main_top").before(html);
$(".content").css("margin-top","1.28rem");
$(".pin_control_top").css('top','1.28rem');
$(".pin_control_content").css("margin-top","2.08rem");
$(".buildingDetail .pin_control_content").css("margin-top","0rem");
$(".buildingDetail .pin_control_content_title:first").css("margin-top","2.08rem");
$(".unitDetail .content1").css("margin-top","2.08rem");
$(".unitDetail .content2").css("margin-top","2.12rem");
$(".unitDetail .content3").css("margin-top","2.12rem");
$(".unit_dis_div").css('top','2.08rem');
$(".performance .topmodular").css("top","2.08rem");
}
if (/ipad/i.test(navigator.userAgent)){
var html = "<div style='width:100%;height:0.2rem;background:#fff;position:fixed;top:0;'></div>";
// $("body").css("padding-top",'1.08rem');
$(".main_top").css('top', '0.2rem');
$(".main_top").before(html);
$(".content").css("margin-top","1.08rem");
$(".pin_control_top").css('top','1.08rem');
$(".pin_control_content").css("margin-top","1.88rem");
$(".buildingDetail .pin_control_content").css("margin-top","0rem");
$(".buildingDetail .pin_control_content_title:first").css("margin-top","1.88rem");
$(".unitDetail .content1").css("margin-top","1.88rem");
$(".unitDetail .content2").css("margin-top","1.92rem");
$(".unitDetail .content3").css("margin-top","1.92rem");
$(".unit_dis_div").css('top','1.88rem');
$(".performance .topmodular").css("top","1.88rem");
}
} else if (/android/.test(ua)) {
$(".main_top").css({"height":"0.96rem","line-height":"0.96rem"});
$(".My_top_img").css("margin-top","0.96rem");
$(".content").css("margin-top","0.96rem");
}else {
$(".main_top").css({"height":"0.96rem","line-height":"0.96rem"});
$(".My_top_img").css("margin-top","0.96rem");
$(".content").css("margin-top","0.96rem"); };

移动端版本兼容(适用于)

<meta name="viewport" content="width=750, user-scalable=no, target-densitydpi=device-dpi">
<script type="text/javascript">
var phoneWidth = parseInt(window.screen.width);
var phoneScale = phoneWidth/640;
var ua = navigator.userAgent;
if (/Android (\d+\.\d+)/.test(ua)){
var version = parseFloat(RegExp.$1);
if(version>2.3){
document.write('<meta name="viewport" content="width=640, minimum-scale = '+phoneScale+', maximum-scale = '+phoneScale+', target-densitydpi=device-dpi">');
}else{
document.write('<meta name="viewport" content="width=640, target-densitydpi=device-dpi">');
}
} else {
document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
}
</script>

  

webApp开发中的总结的更多相关文章

  1. 【原】webapp开发中兼容Android4.0以下版本的css hack

    话说现在的手机型号越来越多,主要还是android和ios这2个巨头称霸了江湖,而他们自带的浏览器内核是webkit,那对于做移动网页开发的同事来说,一般只要做好webkit内核浏览器的展现效果就行了 ...

  2. webapp开发中的一些注意的

    和大多数响应式的布局一样,webapp开发也是需要浮动布局和百分比布局,需要考虑的是小屏幕手机250px和大屏幕设备768px,但是习惯以320px和640px来分割,jq中的一句话$(functio ...

  3. WebApp 开发中常用的代码片段

    其实这里面的多数都是 iOS 上面的代码.其他平台的就没有去验证了. HTML, 从HTML文档的开始到结束排列: <meta name=”viewport” content=”width=de ...

  4. 移动端WEBAPP开发遇到的坑,以及填坑方案!持续更新~~~~

    前言:在移动端WEBAPP开发中会遇到各种各样的问题,通过此文对遇到的问题做一个归纳总结,方便自己日后查询,也给各位前端开发友人做一个参考.   此文中涉及的问题是本人开发中遇到的,解决方案是本人思考 ...

  5. web移动开发中如何实现图标点击态的蒙层效果

    webapp开发中经常需要加入点击二态,即用户点击(tap)页面某个部分时该部分的样式进行相应的变化来相应用户的点击操作,这样能够带来更好的用户体验,今天我们要讨论的是如何给图标加上点击的二态效果. ...

  6. 【blade利刃出鞘】一起进入移动端webapp开发吧

    前言 在移动浪潮袭来的时候,小钗有幸进入框架组做webapp框架开发,过程中遇到了移动端的各种坑,也产生了各种激情,就我们公司的发展历程来说 第一阶段:使用传统方式开发移动站点,少量引入HTML5元素 ...

  7. webapp开发调试环境--weinre配置

    用谷歌调试工具中的手机模拟器模拟手机进行webapp的开发,与真机上的效果还是有些偏差,opera手机模拟器的效果亦不佳.有时在pc上开发出来的webapp效果良好,在部分真机上就出现了偏差,这时候就 ...

  8. (转) 浅析HTML5在移动应用开发中的使用

    (转)浅析HTML5在移动应用开发中的使用 (原)http://www.iteye.com/magazines/67   2012-03-07  来自 UECD.163.com  编辑 wangguo ...

  9. webapp开发需要注意的浏览器内核知识

    Web App:1.开发成本较低使用web开发技术就可以轻松的完成web app的开发2.升级较简单升级不需要通知用户,在服务端更新文件即可,用户完全没有感觉3.维护比较轻松和一般的web一样,维护比 ...

随机推荐

  1. 40、IOS自动打包-Python脚本

    第一种:基于编译的打包 编译工程--找到.app文件--新建Payload文件夹--拷贝.app到Payload文件夹--压缩成zip--更改后缀名为ipa--完成! 第二种(有问题,暂时不需要看) ...

  2. yii2自定义json格式success,error跳转

    /** * ---------------------------------------------- * 操作成功跳转的快捷方法 * @access protected * @param stri ...

  3. Vue + Element UI 实现权限管理系统

    Vue + Element UI 实现权限管理系统 前端篇(一):搭建开发环境 https://www.cnblogs.com/xifengxiaoma/p/9533018.html

  4. C++STL 算法

    算法部分主要由头文件<algorithm>,<numeric>和<functional>组成. <algorithm>是所有STL头文件中最大的一个,其 ...

  5. IntelliJ IDEA 2017版 spring-boot 2.0.3 邮件发送搭建,概念梳理 (二)

    第二部分 邮件发送历史   一.第一封邮件   1.1969年10月,世界上的第一封电子邮件    1969年10月世界上的第一封电子邮件是由计算机科学家Leonard K.教授发给他的同事的一条简短 ...

  6. 第22章:MongoDB-聚合操作--聚合管道--$out

    ①$out $out:利用此操作可以将查询结果输出到指定的集合里面. ②范例:将投影的结果输出到集合里

  7. [好文分享]MySQL 加锁处理分析

    原文转自:http://hedengcheng.com/?p=771 背景 MySQL/InnoDB的加锁分析,一直是一个比较困难的话题.我在工作过程中,经常会有同事咨询这方面的问题.同时,微博上也经 ...

  8. oss 上传文件夹-cloud2-泽优软件

    说明: 1. 修复同时上传多个文件夹崩溃的问题. 2. 修复阿里云(OSS)特殊文件名称无法上传的问题. 3. 文件夹MD5提供配置项(默认关闭).

  9. C#将XML转换成JSON 使用 JavaScript 将 XML 转成 JSON

    如何在ASP.NET中用C#将XML转换成JSON [JavaScript]代码 // Changes XML to JSON function xmlToJson(xml) { // Create ...

  10. codeforces 891 b

    B. Gluttony time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...