Mobile开发之meta篇
来源:互联网 发布:手机漏洞检测软件 编辑:程序博客网 时间:2024/06/08 00:23
- <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" />
width: viewport 的宽度 (范围从 200 到 10,000 ,默认为 980 像素 )
height: viewport 的高度 (范围从 223 到 10,000 )
initial-scale: 初始的缩放比例 (范围从>0到 10 )
minimum-scale: 允许用户缩放到的最小比例
maximum-scale: 允许用户缩放到的最大比例
user-scalable: 用户是否可以手动缩放
- <meta name="apple-mobile-web-app-capable" content="yes" />
是否删除默认的苹果工具栏和菜单栏
- <meta name="apple-mobile-web-app-status-bar-style" content="black" />
当设置了app形式之后,作用是控制状态栏显示样式,但是本机ios7测试之后没啥改变……不解
- <meta name="format-detection"content="telephone=no, email=no" />
iphone会把一串数字识别为电话号码,点击的时候会提示是否呼叫,屏蔽这功能则把telephone设置为no,
要启用电话功能,请使用<a href="tel:13888888888">Call Me : 13888888888</a>来代替,
邮件则为<a href="mailto:someone@microsoft.com?subject=Hello%20again">发送邮件</a>
- 其他的meta设置
<!-- 启用360浏览器的极速模式(webkit) --><meta name="renderer" content="webkit"><!-- 避免IE使用兼容模式 --><meta http-equiv="X-UA-Compatible" content="IE=edge"><!-- 针对手持设备优化,主要是针对一些老的不识别viewport的浏览器,比如黑莓 --><meta name="HandheldFriendly" content="true"><!-- 微软的老式浏览器 --><meta name="MobileOptimized" content="320"><!-- uc强制竖屏 --><meta name="screen-orientation" content="portrait"><!-- QQ强制竖屏 --><meta name="x5-orientation" content="portrait"><!-- UC强制全屏 --><meta name="full-screen" content="yes"><!-- QQ强制全屏 --><meta name="x5-fullscreen" content="true"><!-- UC应用模式 --><meta name="browsermode" content="application"><!-- QQ应用模式 --><meta name="x5-page-mode" content="app"><!-- windows phone 点击无高光 --><meta name="msapplication-tap-highlight" content="no">
此外,apple还有两个有趣的标签:
1. apple-touch-icon
< link rel= "apple-touch-icon" sizes= "76x76" href= "touch-icon-ipad.png">
如果 apple-mobile-web-app-capable
设置为 yes
了,那么在苹果机的safari上可以通过添加到主屏按钮将网站添加到主屏幕上。而设置相应 apple-touch-icon
标签,则添加到主屏上的图标就会使用我们指定的图片。
2. apple-touch-startup-image
< link rel= "apple-touch-startup-image" href= "/startup.png">
基于 apple-mobile-web-app-capable
设置为 yes
,可以为WebApp设置一个类似NativeApp的启动画面。和 apple-touch-icon
不同, apple-mobile-web-app-capable
不支持sizes属性,要使用media来加载不同的启动画面。详细查询 大漠的文章 。
// iPhone<link href="apple-touch-startup-image-320x460.png" media="(device-width: 320px)" rel="apple-touch-startup-image" />// iPhone Retina<link href="apple-touch-startup-image-640x920.png" media="(device-width: 320px) and (-webkit-device-pixel-ratio: 2)" rel="apple-touch-startup-image" />
所以,对于移动端,把通用的起始模板写成sublime的snippet:
<snippet><content><![CDATA[<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" /><meta name="apple-mobile-web-app-capable" content="yes" /><meta name="apple-mobile-web-app-status-bar-style" content="black" /><meta name="format-detection"content="telephone=no, email=no" /><title>${1}</title></head><body>${2}</body></html>]]></content><tabTrigger>mhd</tabTrigger><description>Mobile Frame</description><scope>text.html</scope></snippet>
参考:
http://www.w3cplus.com/mobile/mobile-terminal-refactoring-create-page.html
http://blog.sina.com.cn/s/blog_6d48e77101015kqr.html
http://blog.sina.com.cn/s/blog_3f1fc8950101fz2v.html
- Mobile开发之meta篇
- Mobile开发之meta篇
- Mobile开发之meta篇
- Mobile开发之meta篇 - 秋尘
- GPRS开发系列文章之进阶篇(Windows Mobile)
- visual studio 2008开发windows mobile应用程序之环境篇
- Meta 元数据之百度开发适配器
- .net_移动开发之<mobile:List分页
- 重操旧业之 Windows mobile 开发环境搭建!
- Windows Mobile开发之动态调用WebServcie
- Windows Mobile开发之SQLite的使用
- 我也移动开发之jQuery Mobile
- mobile开发福音mac版之Fiddler
- Dojo Mobile开发学习篇
- mobile 开发
- jQuery Mobile中Meta viewport标记属性
- Meta 标签 apple-mobile-web-app-
- Meta标签中的apple-mobile-w…
- Validform表单验证
- 【Qt学习——零】安装与环境配置
- dicomdict
- JAVA字符串格式化-String.format()的使用
- 数据库学习笔记(三)
- Mobile开发之meta篇
- 根据行间距计算label的高度
- 官方的databinding的资料,顺便练练英语
- 数据挖掘十大经典算法
- RapidXml使用(备忘)
- [Extjs modern]视图绘制顺序简单分析
- 【原博客迁移】2016-05-22 小组交流会
- 自定义ViewGroup及其子类(Linearlayout,Relativelayout,FrameLayout。。。)时onDraw方法没被调用怎么解决
- bzoj 4325: NOIP2015 斗地主 (dfs+剪枝)