The role of common meta tags and comprehensive finishing

Tag provides metadata about the HTML document. It will not appear on the page, but for a machine-readable. It can be used browsers (how to display content or reload page), search engines (keywords), or other web services.

2, the role of

meta data is available in the machine interpretation, tells the machine how to parse this page, there is a purpose that can be added to the sending server http header content browser, for example, we add the following meta tag for the page:

1
2
<meta http-equiv="charset" content="iso-8859-1">
<meta http-equiv="expires" content="31 Dec 2008">

Browser header will include these:

1
2
charset:iso-8859-1
expires:31 Dec 2008

Only the browser can accept these additional header fields, and can use them in an appropriate manner, these fields makes sense.

3, meta required and optional attributes

meta content attribute is required, of course, does not mean that meta tag must have content, but when there are http-equiv or name attributes, content attributes must be directed. E.g:

Required attributes

1
<meta name="keywords" content="HTML,ASP,PHP,SQL">

There is content in the description of the property is carried out keywords, so it can also be understood as a key to it, is {keywords: "HTML, ASP, PHP, SQL"}.

Optional attributes

In W3school, for the optional attributes meta Speaking of the three, namely, http-equiv, name and scheme. Considering the scheme is not very common, so just say it before the next two properties.

http-equiv

http-equiv attribute is to add the http header content of some custom, or need to add additional content http head, and needs to be sent to the browser, we can use this property. In the meta effect the above there are simple instructions, so now give you an example. For example, we do not want to use js to redirect http header content control, it can be controlled such that:

1
<meta http-equiv="Refresh" content="5;url=https://netlover.cn" />

After this was added in the page, it will jump to a specified page 5 seconds, to see the effect of the example W3school

name

The second optional attribute name, this property is for the browser to parse, for some browser compatibility issues, the name attribute is the most common, of course, there is a premise that your browser can resolve the name written into the property before they can , otherwise it is meaningless. Or give you an example:

1
<meta name="renderer" content="webkit">

This meta tag tells the browser means that, when analyzed by webkit core, of course, provided there is webkit browser kernel can, or else it does not make sense. Of course, you may have seen this question, this renderer is where to come out, I want to know how it? This is the corresponding development of the document in the browser will be demonstrated, for example, the renderer 360 is described browser. 360 browser kernel documentation control Meta Tags

Common large sum meta tags

Then there is the usual large sum of meta tags you, I will do as much as possible of the whole

charset

charset declaration is a document using character encoding, mainly used to solve the garbage problem is that it is worth mentioning that this charset must write the first line , otherwise it may cause garbled.

There are two ways for writing charset

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

Two are equivalent.

Baidu prohibited transcoding

Baidu will automatically be transcoded pages, this label is prohibited Baidu transcoding

1
<meta http-equiv="Cache-Control" content="no-siteapp" />

SEO optimization section

1
2
3
4
5
6
7
8
9
10

"Segmentation of value, usually there are several values: none, noindex, nofollow, all, index and follow. -> <







meta name="robots" content="index,follow">

viewport

viewport mainly affect the movement of end page layout, such as:

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

content parameters:

  • width viewport width (Numerical / device-width)
  • height viewport height (value / device-height)
  • initial-scale initial scale
  • maximum-scale maximum zoom ratio
  • minimum-scale minimum scale
  • user-scalable whether to allow the user zooms (yes / no)

Each browser platform

Microsoft Internet Explorer

1
2
3
4
5
6
7
8
9
10
11
<-! Ie priority to use the latest version -> 
< Meta HTTP-equiv = "the X-UA-compatible-" Content = "ie = Edge" >
<! - whether to open cleartype display ->
< Meta http- equiv = "ClearType" Content = "ON" >
< Meta name = "skype_toolbar" Content = "skype_toolbar_parser_compatible" >
<-! the Pinned Site Five ->
<-! IEs 10 / the Windows. 8 ->
< Meta name = " msapplication-TileImage " content="pinned-tile-144.png">
<meta name="msapplication-TileColor" content="#009900">
<!-- IE 11 / Windows 9.1 -->
<meta name="msapplication-config" content="ieconfig.xml">

Google Chrome

1
2
3
4
<! - priority latest chrome version -> 
< Meta HTTP-equiv = "the X-UA-Compatible-" Content = "chrome = 1" />
<! - automatic translation prohibit ->
< Meta name = " Google " value = " notranslate " >

360 browser

1
2
<-! Browser parses choose to use the kernel -> 
< Meta name = "renderer" Content = "WebKit | IE-CoMP | IE-Stand" >

QQ mobile browser

1
2
3
4
5
6
<! - lock the screen in a specific direction -> 
< Meta name = "X5-Orientation" Content = "Landscape / Portrait" >
<! - Full Screen ->
< Meta name = "X5-Fullscreen" Content = " to true " >
<-! page will display the application mode ->
< Meta name = " page-X5-the mODE " Content = " App " >

Apple iOS

1
2
3
4
5
6
7
8
9
10
11
<!-- Smart App Banner -->
<meta name="apple-itunes-app" content="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT">
<!-- 禁止自动探测并格式化手机号码 -->
<meta name="format-detection" content="telephone=no">
<!-- Add to Home Screen添加到主屏 -->
<!-- 是否启用 WebApp 全屏模式 -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- 设置状态栏的背景颜色,只有在 “apple-mobile-web-app-capable” content=”yes” 时生效 -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!-- 添加到主屏后的标题 -->
<meta name="apple-mobile-web-app-title" content="App Title">

Google Android

1
2
3
4
<meta name="theme-color" content="#E64545">
<!-- 添加到主屏 -->
<meta name="mobile-web-app-capable" content="yes">
<!-- More info: https://developer.chrome.com/multidevice/android/installtohomescreen -->

App Links

1
2
3
4
5
6
7
8
9
10
11
<!-- iOS -->
<meta property="al:ios:url" content="applinks://docs">
<meta property="al:ios:app_store_id" content="12345">
<meta property="al:ios:app_name" content="App Links">
<!-- Android -->
<meta property="al:android:url" content="applinks://docs">
<meta property="al:android:app_name" content="App Links">
<meta property="al:android:package" content="org.applinks">
<!-- Web Fallback -->
<meta property="al:web:url" content="http://applinks.org/documentation">
<!-- More info: http://applinks.org/documentation/ -->

最后——移动端常用的meta

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<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" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<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="telphone=no, email=no" /><!-- 忽略页面中的数字识别为电话,忽略email识别 -->
<!-- 启用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="Page-X5-MODE" Content = "App" >
<-! click Phone Windows no highlights ->
< Meta name = "msapplication-TAP-highlight" Content = "NO" >
<-! accommodate movement end end ->

This link: https://netlover.cn/2018/08/15/meta-all.html

Original: Big Box  effect commonly used meta tags and comprehensive finishing


Guess you like

Origin www.cnblogs.com/chinatrump/p/11588812.html