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. C# 单例模式的五种写法

    1.简单实现           C#   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 public sealed c ...

  2. GOAP

    市面上Unity人工智能的书籍基本上都是介绍这几个方面: AI角色的自主移动 --- 操控行为, 单体,小队,群体的行为. 我之前的文章 Unity Movement AI (一) , Unity M ...

  3. Django的学习(二)————Templates

    一.django的模板: 在settings.py的文件中可以看到并设置这个模板. 1.直接映射: 通过建立的文件夹(templates)和文件(html)来映射. <!DOCTYPE html ...

  4. ubuntu的应用中心打不开、闪退

    原因没有细究,但问题已经解决简单粗暴: 1.更新列表 apt-get update apt-get dist-upgrade 2.重新安装应用中心 apt-get install  --reinsta ...

  5. python基于pillow库的简单图像处理

    from PIL import Image from PIL import ImageFilter from PIL import ImageEnhance import matplotlib.pyp ...

  6. sql中的CONCAT函数运用实例1

    1 第一个例子 select a.*,b.name as repayment_type_value,c.name as status_value, d.product_name, CONCAT(a.d ...

  7. poj1741(点分模板)

    #include<iostream> #include<cstring> #include<cmath> #include<cstdio> #inclu ...

  8. (最短路)Silver Cow Party --POJ--3268

    题目链接: http://poj.org/problem?id=3268 题意: 先求出所有牛到x的最短路,再求出x到所有牛的最短路,两者相加取最大值(单向图)(可以用迪杰斯特拉,SPFA) 迪杰斯特 ...

  9. Windows Phone 8.1不完全体验报告

    在Build 2014中,微软倾心打造的Windows Phone 8.1终于粉墨登场,会场掌声不断.在大会结束后一周,经过漫长的等待,终于等到了开发者预览的推送,迫不及待地体验这一跨时代的移动系统. ...

  10. 17、文件IO详解及实例

    上篇文章已经讲过了文件系统的一些基本的概念,这里首先对文件IO进行详细的学习,文件IO也称为系统调用IO,是操作系统为"用户态"运行的进程和硬件交互提供的一组接口,即操作系统内核留 ...