星空网 > 软件开发 > 网页设计

The META for Mobile terminal

近来想写一些好玩的手机网页,在这里整理了一下在手机端的meta标签,以免下次忘记,再去网上搜。

meta指元素可提供有关页面的元信息(meta-information),比如针对搜索引擎和更新频度的描述和关键词。 标签位于文档的头部,不包含任何内容。 标签的属性定义了与文档相关联的名称/值对。

meta标签的作用有:搜索引擎优化(SEO),定义页面使用语言,自动刷新并指向新的页面,实现网页转换时的动态效果,控制页面缓冲,网页定级评价,控制网页显示的窗口等

下面是手机网页的一些meta:

1,<meta  name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" >

该标签用于强制让文档的宽度与设备的宽度保持1:1,并且文档最大的宽度比例是1.0,且不允许用户点击屏幕放大浏览;

  • width - viewport的宽度 height - viewport的高度;
  • initial-scale - 初始的缩放比例;
  • minimum-scale - 允许用户缩放到的最小比例;
  • maximum-scale - 允许用户缩放到的最大比例;
  • user-scalable - 用户是否可以手动缩放;   

2,<meta name="format-detection" content="telephone=no,email=no">

该标签用于禁止识别手机号码和邮箱。

  • 关闭识别手机号码若要识别某一个手机号:<a href=”tel:88888888888”>88888888888</a>
  • 关闭识别邮箱若要识别某一个邮箱:<a href=”mailto:xx@zhudongdong.cn”>邮箱</a>

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

该标签是iphone设备中的safari私有meta标签,它表示:删除默认的苹果工具栏和菜单栏。content有两个值”yes”和”no”,当我们需要显示工具栏和菜单栏时,这个行meta就不用加了,默认就是显示。网站开启对web app程序的支持。

4,<meta  name="apple-mobile-web-app-status-bar-style" content="black" >

改标签也是iphone的私有标签,它指定的iphone中safari顶端的状态条的样式

  • 在web app应用下状态条(屏幕顶部条)的颜色;
  • 默认值为default(白色),可以定为black(黑色)和black-translucent(灰色半透明)。

注意:若值为“black-translucent”将会占据页面px位置,浮在页面上方(会覆盖页面20px高度–iphone4和itouch4的Retina屏幕为40px)。

5,<meta name="apple-touch-fullscreen" content="yes">

该标签是safari私有meta标签,它表示:允许全屏模式浏览;

 

苹果web app其他设置:

当然,配合web app的icon 和 启动界面需要额外的两端代码进行设定,如下所示:

<link rel="apple-touch-icon-precomposed" href="iphone_milanoo.png" />

iOS用rel="apple-touch-icon",android 用rel="apple-touch-icon-precomposed"。这样就能在用户把网页存为书签时,在手机HOME界面创建应用程序样式的图标。

说明:这个link就是设置web app的放置主屏幕上icon文件路径

使用:

  • 该路径需要注意的就是放到将网站的文档根目录下但不是服务器的文档的根目录。
  • 图片尺寸可以设定为57*57(px)或者Retina可以定为114*114(px),ipad尺寸为72*72(px)

<link rel="apple-touch-startup-image" href=milanoo_startup.png" />

说明:这个link就是设置启动时候的界面(图片五),放置的路劲和上面类似。

使用:

  • 该路径需要注意的就是放到将网站的文档根目录下但不是服务器的文档的根目录。
  • 官方规定启动界面的尺寸必须为 320*640(px),原本以为Retina屏幕可以支持双倍,但是不支持,图片显示不出来。

其他模式:

  • <!-- 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">
  • <!-- 360 Webkit -->
  • <meta name="renderer" content="webkit">

大型网站实例:

一、天猫

<title>天猫触屏版</title>

<meta content="text/html; charset=utf-8" http-equiv="Content-Type">

<meta charset="utf-8">

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

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

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

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

二、淘宝

<title>淘宝网触屏版</title>

<meta charset="utf-8">

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

<meta content="yes" name="apple-touch-fullscreen">

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

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

<meta property="wb:webmaster" content="c51923015ca19eb1">

<meta name="author" content="m.taobao.com">

<meta name="copyright" content="Copyright ©m.taobao.com 版权所有">

<meta name="revisit-after" content="1 days">

<meta name="keywords" content="">

<meta name="description" content="">

三、京东

<title> 京东 - 手机版 </title>

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;">

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

<meta name="Keywords" content="手机购物,WAP商城,日用百货,3C家电,汽车用品">

<meta name="description" content="京东手机版提供了包括数码、家电、手机、电脑配件、网络产品、日用百货等数万种商品,手机快捷购物,就上京东手机版。">

四、网易

<title>手机网易网</title>

<meta charset="UTF-8">

<meta content="width=device-width,user-scalable=no" name="viewport">

<meta name="apple-itunes-app" content="app-id=425349261">

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

五、百度

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

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

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




原标题:The META for Mobile terminal

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

双十一:https://www.goluckyvip.com/tag/7944.html
淘宝:https://www.goluckyvip.com/tag/7945.html
代表处年审:https://www.goluckyvip.com/tag/79451.html
直通车:https://www.goluckyvip.com/tag/7946.html
跨境贸易:https://www.goluckyvip.com/tag/7947.html
境外 开账户:https://www.goluckyvip.com/tag/79470.html
泰国签证有出生地 泰国出生入籍护照:https://www.vstour.cn/a/411245.html
宠物梳专利查询分析:https://www.kjdsnews.com/a/1842293.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流