移动web app开发小贴士 收藏有用
1 创建主屏幕图标 (Creating a home screen icon ,for ios)
1
2
3
4
5
6
|
//57*57
<link rel="apple-touch-icon"href="http://wlog.cn/html/"/custom_icon.png"/>
<link rel="apple-touch-icon" href="touch-icon-iphone.png" />
<link rel="apple-touch-icon" sizes="72x72" href="touch-icon-ipad.png" />
<link rel="apple-touch-icon" sizes="114x114" href="touch-icon-iphone4.png" />
<link rel="apple-touch-icon" sizes="144x144" href="touch-icon-ipad-retina.png" />
|
启动画面图像 (Creating a splash screen, for ios)
1
2
3
4
5
6
7
8
9
10
11
12
|
<!!-- iPhone SPLASHSCREEN-->
<!link href="http://wlog.cn/html/"apple-touch-startup-image-320x460.png" media="(device-width: 320px)" rel="apple-touch-startup-image" />
<!!-- iPhone (Retina) SPLASHSCREEN-->
<!link href="apple-touch-startup-image-640x920.png" media="(device-width: 320px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
<!!-- iPad (portrait) SPLASHSCREEN-->
<!link href="apple-touch-startup-image-768x1004.png" media="(device-width: 768px) and (orientation: portrait)" rel="apple-touch-startup-image" />
<!!-- iPad (landscape) SPLASHSCREEN-->
<!link href="apple-touch-startup-image-748x1024.png" media="(device-width: 768px) and (orientation: landscape)" rel="apple-touch-startup-image" />
<!!-- iPad (Retina, portrait) SPLASHSCREEN-->
<!link href="apple-touch-startup-image-1536x2008.png" media="(device-width: 1536px) and (orientation: portrait) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
<!!-- iPad (Retina, landscape) SPLASHSCREEN-->
<link href="apple-touch-startup-image-1496x2048.png"media="(device-width: 1536px) and (orientation: landscape) and (-webkit-device-pixel-ratio: 2)"rel="apple-touch-startup-image" />
|
3 全屏 (Making it full-screen, for ios)– 更像本地App
1
|
<meta name="apple-mobile-web-app-capable"content="yes" />
|
4 改变状态栏 (Changing the phone status bar, for ios)
content属性default, black and black-translucent
1
|
<meta name="apple-mobile-web-app-status-bar-style"content="black" />
|
5 阻止缩放 (Preventing scaling)
1
|
<meta name="viewport"content="user-scalable=no, width=device-width" />
|
6 阻止弹性滚动(Preventing elastic scrolling)
1
2
3
4
5
6
7
8
9
|
<script>
functionBlockMove(event){
//Tell Safari not to move the window.
event.preventDefault();
}
</script>
<body ontouchmove="BlockMove(event);">
...
</body>
|
7 检测屏幕是否旋转(Detect whether device supports orientationchange event, otherwise fall back to the resize event)
1
2
3
4
5
6
7
|
//Detect whether device supports orientationchange event, otherwise fall back to
//the resize event.
varsupportsOrientationChange="onorientationchange"inwindow,
orientationEvent=supportsOrientationChange?"orientationchange":"resize";
window.addEventListener(orientationEvent,function(){
alert('HOLY ROTATING SCREENS BATMAN:'+window.orientation+" "+screen.width);
},false);
|
8 禁止webapp跳转到safari(for ios)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
// Mobile Safari in standalone mode
if(("standalone"inwindow.navigator)&&window.navigator.standalone){
// If you want to prevent remote links in standalone web apps opening Mobile Safari, change 'remotes' to true
varnoddy,
remotes=false;
document.addEventListener('click',function(event){
noddy=event.target;
//Bubble up until we hit link or top HTML element. Warning: BODY element is not compulsory so better to stop on HTML
while(noddy.nodeName!=="A"&&noddy.nodeName!=="HTML"){
noddy=noddy.parentNode;
}
if('href'innoddy&&noddy.href.indexOf('http')!==-1&&(noddy.href.indexOf(document.location.host)!==-1||remotes)){
event.preventDefault();
document.location.href=noddy.href;
}
},false);
}
|
9 禁用手机号码链接(for ios)
1
|
<meta name="format-detection"content="telephone=no"/>
|
10 阻止旋转屏幕时自动调整字体大小
1
|
-webkit-text-size-adjust:none;
|
11 IOS中禁止用户选中文字
1
|
-webkit-user-select:none;
|
12 iOS中如何禁止用户保存图片 复制图片
1
|
-webkit-touch-calloutt:none;
|
13 语音输入
1
|
<input type="text"x-webkit-speech />
|
14 文件上传, 从相机捕获媒体
XHTML
1
2
3
|
<input type="file"accept="image/*; capture=camera" />
<input type="file"accept="video/*; capture=camcorder" />
<input type="file"accept="audio/*; capture=microphone" />
|
15 电话短信
1
2
3
|
<a href="http://wlog.cn/html/"sms:18888886666,18888885555″]]> 发送短信给多个人 的链接
<a href="sms:18888886666?body=sms txt"]]> 发送短信附带内容 的链接
<a href="tel:18888886666″]]>Call us at 18888886666</a]]>拨打电话的链接
|
移动web app开发小贴士 收藏有用的更多相关文章
- web移动开发小贴士
1.判断手机类型 var u = navigator.userAgent; || u.indexOf(; //android var isiOS = !!u.match(/\(i[^;]+;( U;) ...
- 移动web app开发必备 - Deferred 源码分析
姊妹篇 移动web app开发必备 - 异步队列 Deferred 在分析Deferred之前我觉得还是有必要把老套的设计模式给搬出来,便于理解源码! 观察者模式 观察者模式( 又叫发布者-订阅者模 ...
- 微信公众平台开发:Web App开发入门
WebApp与Native App有何区别呢?Native App:1.开发成本非常大.一般使用的开发语言为JAVA.C++.Objective-C.2.更新体验较差.同时也比较麻烦.每一次发布新的版 ...
- 移动端web app开发学习笔记
移动web和pc端web以及web app 移动web开发跟web前端开发差别很小,使用的技术都是html+css+js.手机网页可以理解成pc网页的缩小版加一些触摸特性.在浏览器中进行的网页开发,最 ...
- Native App开发 与Web App开发(原生与web开发优缺点)
Native App开发 Native App开发即我们所称的传统APP开发模式(原生APP开发模式),该开发针对IOS.Android等不同的手机操作系统要采用不同的语言和框架进行开发,该模式通常是 ...
- 前端读者 | Web App开发入门
本文来自互联网 自Iphone和Android这两个牛逼的手机操作系统发布以来,在互联网界从此就多了一个新的名词 - Web App(意为基于WEB形式的应用程序).业界关于Web App与Nativ ...
- 移动web app开发必备 - 异步队列 Deferred
背景 移动web app开发,异步代码是时常的事,比如有常见的异步操作: Ajax(XMLHttpRequest) Image Tag,Script Tag,iframe(原理类似) setTimeo ...
- App.js – 用于移动 Web App 开发的 JS 界面库
App.js 是一个轻量级的 JavaScript UI 库,用于创建像本地应用程序的移动 Web 应用而不牺牲性能和体验.它是跨平台的,特定的UI设计,配置类似原生的过渡效果.App.js 的目的是 ...
- web app 开发必不可少的滑动插件 Flipsnap
flipsnap.js一个轻量级的滑动效果JS开发库,仅有8k大小(压缩版),包含了10种滑动方式,是web app开发必备的js库,除了兼容主流的智能手机浏览器(iossafari,android, ...
随机推荐
- iOS 用protocol 和 用继承小体会
最近写程序时,2个类都有相同的函数,又因为在用oc,所以就用了protocol来实现.后来发现其实这2个类除了相同的函数,还需要一些相同的变量,当初用继承的话会更简单.
- 5.django笔记之form保存表单信息,动态select
作者:刘耀 一.使用form保存用户输入过的信息 场景:例如 如果用户注册,那么他输入n多个表单之后,那么他提交是时候,如果错误返回的时候,那么需要重新再输入表单内容.这样会影响用户体验,所以,使用f ...
- Stanford大学机器学习公开课(五):生成学习算法、高斯判别、朴素贝叶斯
(一)生成学习算法 在线性回归和Logistic回归这种类型的学习算法中我们探讨的模型都是p(y|x;θ),即给定x的情况探讨y的条件概率分布.如二分类问题,不管是感知器算法还是逻辑回归算法,都是在解 ...
- SharedPreferences&SQLite比较
SharedPreferences是Android平台上一个轻量级的存储类,主要是保存一些常用的配置比如窗口状态,一般在Activity中 重载窗口状态onSaveInstanceState保存一般使 ...
- hdu 4091 线性规划
分析转自:http://blog.csdn.net/dongdongzhang_/article/details/7955136 题意 : 背包能装体积为N, 有两种宝石, 数量无限, 不能切割. ...
- SqlServer2000数据库字典--表结构.sql
SELECT TOP 100 PERCENT --a.id, CASE WHEN a.colorder = 1 THEN d.name ELSE '' END AS 表名, C ...
- AutoCompleteTextView自动填充文本
布局: <AutoCompleteTextView android:id="@+id/auto" android:layout_width="match_paren ...
- 详细剖析电脑hosts文件的作用和修改
提到电脑系统中的hosts文件,如果不是太熟悉的话,还真是闻所未闻,一是由于系统的hosts文件为系统属性,在系统默认设置下,我们根本无法看到它的存在,而是由于身处系统深层文件夹内,我们一般也无法察觉 ...
- Professional Android Application Development
Professional Android Application Development 访问地址 http://docs.google.com/fileview?id=0ByVHV5sjM4fNNj ...
- 解析Cloudera Manager内部结构、功能包括配置文件、目录位置等
转载自 http://www.aboutyun.com/thread-9189-1-1.html 问题导读1.CM的安装目录在什么位置? 2.hadoop配置文件在什么位置? 3.Cloudera m ...