Home  >  Article  >  Web Front-end  >  [Transfer] What you don’t know about the HTML header tag

[Transfer] What you don’t know about the HTML header tag

WBOY
WBOYOriginal
2016-10-22 00:00:108320browse

HTML has a lot of header content, including header information for SEO and header information for mobile devices. Moreover, each browser core and each domestic browser manufacturer have their own tag elements, which have many differences. Mobile work has increasingly become an important part of front-end work. In addition to ordinary project development, the HTML header tag function, especially the functional attributes of meta, link and other tags, is very important. Here is a list of <head> parts, so that everyone can understand the meaning of each tag and corresponding attributes, and write <head> head tags that meet your needs, which can effectively enhance the page. Availability.

Note: Last year, I compiled the html5 head tags that mobile front-ends must know. With time and browser manufacturers’ upgrades, it seems a bit outdated now. So I reorganized it. Added new content, some outdated tips, and added some instructions for some desktop browsers.

Basic HTML header tags

The following are the basic header elements of HTML:

<span style="color: #0000ff;"><!</span><span style="color: #ff00ff;">doctype html</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">html</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">head</span><span style="color: #0000ff;">></span>
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">charset</span><span style="color: #0000ff;">="utf-8"</span><span style="color: #0000ff;">></span>
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="x-ua-compatible"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="ie=edge"</span><span style="color: #0000ff;">></span>
    <span style="color: #008000;"><!--</span><span style="color: #008000;">移动端的页面这个可以忽略,具体可以查看本文Internet Explorer浏览器部分</span><span style="color: #008000;">--></span>
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=device-width, initial-scale=1"</span><span style="color: #0000ff;">></span>
    <span style="color: #008000;"><!--</span><span style="color: #008000;">具体可以查看本文 为移动设备添加 viewport 部分</span><span style="color: #008000;">--></span>
    <span style="color: #008000;"><!--</span><span style="color: #008000;"> 以上 3 个 meta 标签 *必须* 放在 head 的最前面;其他任何的 head 内容必须在这些标签的 *后面* </span><span style="color: #008000;">--></span>
    <span style="color: #0000ff;"><</span><span style="color: #800000;">title</span><span style="color: #0000ff;">></span>页面标题<span style="color: #0000ff;"></</span><span style="color: #800000;">title</span><span style="color: #0000ff;">></span><span style="color: #000000;">
    ...
</span><span style="color: #0000ff;"></</span><span style="color: #800000;">head</span><span style="color: #0000ff;">></span>

Among them

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="x-ua-compatible"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="ie=edge"</span><span style="color: #0000ff;">></span>

During desktop development, you can let IE browser render the page in the latest mode. For details, please see the Internet Explorer browser section of this article.
If your page is determined to only run in desktop browsers, then

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=device-width, initial-scale=1"</span><span style="color: #0000ff;">></span>

Can also be omitted.

DOCTYPE

DOCTYPE (Document Type), this declaration is located at the forefront of the document, before the html tag. This tag tells the browser which HTML or XHTML specification the document uses.

Use HTML5 doctype, case-insensitive.

<span style="color: #0000ff;"><!</span><span style="color: #ff00ff;">DOCTYPE html</span><span style="color: #0000ff;">></span> <span style="color: #008000;"><!--</span><span style="color: #008000;"> 使用 HTML5 doctype,不区分大小写 </span><span style="color: #008000;">--></span>

charset

Declare the character encoding used by the document,

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">charset</span><span style="color: #0000ff;">="utf-8"</span><span style="color: #0000ff;">></span>

Before html5, the web page would read like this:

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="Content-Type"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="text/html; charset=utf-8"</span><span style="color: #0000ff;">></span>

These two are equivalent, you can read more specifically: <meta charset='utf-8'> vs <meta http-equiv='Content-Type'>, so it is recommended to use Short and easy to remember.

lang attribute

More standard way of writing lang attribute http://zhi.hu/XyIa

Simplified Chinese

<span style="color: #0000ff;"><</span><span style="color: #800000;">html </span><span style="color: #ff0000;">lang</span><span style="color: #0000ff;">="zh-cmn-Hans"</span><span style="color: #0000ff;">></span> <span style="color: #008000;"><!--</span><span style="color: #008000;"> 更加标准的 lang 属性写法 http://zhi.hu/XyIa </span><span style="color: #008000;">--></span>

Traditional Chinese

<span style="color: #0000ff;"><</span><span style="color: #800000;">html </span><span style="color: #ff0000;">lang</span><span style="color: #0000ff;">="zh-cmn-Hant"</span><span style="color: #0000ff;">></span> <span style="color: #008000;"><!--</span><span style="color: #008000;"> 更加标准的 lang 属性写法 http://zhi.hu/XyIa </span><span style="color: #008000;">--></span>

In rare cases, it is necessary to add area codes, usually to emphasize the differences in Chinese usage in different regions, for example:

<span style="color: #0000ff;"><</span><span style="color: #800000;">p </span><span style="color: #ff0000;">lang</span><span style="color: #0000ff;">="zh-cmn-Hans"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">strong </span><span style="color: #ff0000;">lang</span><span style="color: #0000ff;">="zh-cmn-Hans-CN"</span><span style="color: #0000ff;">></span>菠萝<span style="color: #0000ff;"></</span><span style="color: #800000;">strong</span><span style="color: #0000ff;">></span>和<span style="color: #0000ff;"><</span><span style="color: #800000;">strong </span><span style="color: #ff0000;">lang</span><span style="color: #0000ff;">="zh-cmn-Hant-TW"</span><span style="color: #0000ff;">></span>鳳梨<span style="color: #0000ff;"></</span><span style="color: #800000;">strong</span><span style="color: #0000ff;">></span>其实是同一种水果。只是大陆和台湾称谓不同,且新加坡、马来西亚一带的称谓也是不同的,称之为<span style="color: #0000ff;"><</span><span style="color: #800000;">strong </span><span style="color: #ff0000;">lang</span><span style="color: #0000ff;">="zh-cmn-Hans-SG"</span><span style="color: #0000ff;">></span>黄梨<span style="color: #0000ff;"></</span><span style="color: #800000;">strong</span><span style="color: #0000ff;">></span><span style="color: #000000;">。
</span><span style="color: #0000ff;"></</span><span style="color: #800000;">p</span><span style="color: #0000ff;">></span>

Why lang="zh-cmn-Hans" instead of what we usually write lang="zh-CN" , please read further: Should the statement at the head of the page be lang="zh" or lang =”zh-cn”.

Meta tag

The

meta tag is an auxiliary tag in the head of HTML. It is located between the <head> and <title> tags in the head of the HTML document. It provides information invisible to the user. Although this part of information is invisible to users, it is very powerful, especially in today's front-end development work. Setting appropriate meta tags can greatly improve the usability of website pages.

In desktop development, the meta tag is usually used to define page themes for search engine optimization (SEO) and robots, or to define cookies on the user's browser; it can be used to identify the author, set the page format, and mark the content summary and Keywords; you can also set the page to refresh itself based on intervals you define, set RASC content levels, and more.

In mobile development, in addition to the functional settings in the desktop, meta tags also include practical settings such as viewport settings, icons added to the home screen, tab colors, etc. For details, please see the detailed introduction later.

meta tag classification

meta tags can be divided into two parts according to different attributes: http-equiv and name attributes.

http-equiv: It is equivalent to the file header function of http. It can return some useful information to the browser to help the browser display the web page content correctly.
name attribute: mainly used to describe web pages, and the corresponding attribute value is content. The content in content is mainly convenient for browsers, search engines and other robots to identify, etc.

Recommended meta tags


<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">charset</span><span style="color: #0000ff;">="utf-8"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="x-ua-compatible"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="ie=edge"</span><span style="color: #0000ff;">></span>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

 

<meta http-equiv="Content-Security-Policy" content="default-src 'self'">


 

<meta name="application-name" content="应用名称">
 


<meta name="description" content="一个页面描述">
 

<meta name="robots" content="index,follow,noodp">
<meta name="googlebot" content="index,follow">
 

<meta name="google" content="nositelinkssearchbox">
 

<meta name="google" content="notranslate">
 

<meta name="google-site-verification" content="verification_token">
 

<meta name="generator" content="program">
 

<meta name="subject" content="你的网站主题">
 

<meta name="abstract" content="">
 

<meta name="url" content="https://example.com/">
 
<meta name="directory" content="submission">
 

<meta name="rating" content="General">
 

<meta name="referrer" content="never">
 

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="format-detection"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="telephone=no"</span><span style="color: #0000ff;">></span>
 

<meta http-equiv="x-dns-prefetch-control" content="off">
 

<meta http-equiv="set-cookie" content="name=value; expires=date; path=url">
 

<meta http-equiv="Window-Target" content="_value">
 

<meta name="ICBM" content="latitude, longitude">
<meta name="geo.position" content="latitude;longitude">

<meta name="geo.region" content="country[-state]">

<meta name="geo.placename" content="city/town">

For related detailed instructions, please check:

  • Meta tags recognized by Google
  • WHATWG Wiki: Meta extension
  • ICBM – Wikipedia
  • GeoTagging – Wikipedia

Add viewport for mobile devices

viewport can make the layout display better on mobile browsers. I usually write

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name </span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content </span><span style="color: #0000ff;">="initial-scale=1, maximum-scale=3, minimum-scale=1, user-scalable=no"</span><span style="color: #0000ff;">></span> <span style="color: #008000;"><!--</span><span style="color: #008000;"> `width=device-width` 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边 http://bigc.at/ios-webapp-viewport-meta.orz </span><span style="color: #008000;">--></span>

width=device-width 会导致 iPhone 5 添加到主屏后以 WebApp 全屏模式打开页面时出现黑边(http://bigc.at/ios-webapp-viewport-meta.orz)

content 参数:

  • width viewport 宽度(数值/device-width)
  • height viewport 高度(数值/device-height)
  • initial-scale 初始缩放比例
  • maximum-scale 最大缩放比例
  • minimum-scale 最小缩放比例
  • user-scalable 是否允许用户缩放(yes/no)
  • minimal-ui iOS 7.1 beta 2 中新增属性(注意:iOS8 中已经删除),可以在页面加载时最小化上下状态栏。这是一个布尔值,可以直接这样写:
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=device-width, initial-scale=1, minimal-ui"</span><span style="color: #0000ff;">></span>

而如果你的网站不是响应式的,请不要使用 initial-scale 或者禁用缩放。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=device-width,user-scalable=yes"</span><span style="color: #0000ff;">></span>

相关链接:非响应式设计的viewport

适配 iPhone 6 和 iPhone 6plus 则需要写:

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=375"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=414"</span><span style="color: #0000ff;">></span>

大部分 4.7~5 寸的安卓设备的 viewport 宽设为 360px,iPhone 6 上却是 375px,大部分 5.5 寸安卓机器(比如说三星 Note)的 viewport 宽为 400,iPhone 6 plus 上是 414px。

SEO 优化部分

  • 页面标题<title>标签(head 头部必须)
    <span style="color: #0000ff;"><</span><span style="color: #800000;">title</span><span style="color: #0000ff;">></span>your title<span style="color: #0000ff;"></</span><span style="color: #800000;">title</span><span style="color: #0000ff;">></span>
  • 页面关键词 keywords
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="keywords"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="your keywords"</span><span style="color: #0000ff;">></span>
  • 页面描述内容 description
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="description"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="your description"</span><span style="color: #0000ff;">></span>
  • 定义网页作者 author
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="author"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="author,email address"</span><span style="color: #0000ff;">></span>
  • 定义网页搜索引擎索引方式,robotterms 是一组使用英文逗号「,」分割的值,通常有如下几种取值:none,noindex,nofollow,all,index和follow。
    <span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="robots"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="index,follow"</span><span style="color: #0000ff;">></span>

相关链接:WEB1038 – 标记包含无效的值

百度禁止转码

通过百度手机打开网页时,百度可能会对你的网页进行转码,脱下你的衣服,往你的身上贴狗皮膏药的广告,为此可在 head 内添加

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="Cache-Control"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="no-siteapp"</span> <span style="color: #0000ff;">/></span>

相关链接:SiteApp 转码声明

不推荐的 meta 属性

下面是不推荐使用的 meta 属性,因为它们采用率低,或已弃用:

<span style="color: #008000;"><!--</span><span style="color: #008000;"> 用于声明文档语言,但支持得不是很好。最好使用 <html lang=""> </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="language"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="en"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> Google 无视 & Bing 认为垃圾的指示器 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="keywords"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="你,关键字,在这里,不使用空格,而用逗号进行分隔"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 目前没有在任何搜索引擎中使用过的声明 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="revised"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="Sunday, July 18th, 2010, 5:15 pm"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 为垃圾邮件机器人收获 email 地址提供了一种简单的方式 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="reply-to"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="email@example.com"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 最好使用 <link rel="author"> 或 humans.txt 文件 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="author"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="name, email@example.com"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="designer"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="owner"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 告诉搜索机器人一段时间后重新访问该网页。这不支持,因为大多数搜索引擎使用随机时间间隔来重新抓取网页 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="revisit-after"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="7 days"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 在一段时间后将用户重定向到新的 URL </span><span style="color: #008000;">--></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> W3C 建议不要使用该标签。Google 建议使用服务器端的 301 重定向。</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="refresh"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="300; url=https://example.com/"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 描述网站的主题 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="topic"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 公司概要或网站目的 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="summary"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 一个已废弃的标签,和关键词 meta 标签的作用相同 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="classification"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="business"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 是否是相同的 URL,年代久远且不支持 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="identifier-URL"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="https://example.com/"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 和关键词标签类似的功能 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="category"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">=""</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 确保你的网站在所有国家和语言中都能显示 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="coverage"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="Worldwide"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 和 coverage 标签相同 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="distribution"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="Global"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 控制在互联网上哪些用户可以访问 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="Pics-label"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="value"</span><span style="color: #0000ff;">></span> 
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 缓存控制 </span><span style="color: #008000;">--></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 最好在服务器端配置缓存控制 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="Expires"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="0"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="Pragma"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="no-cache"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="Cache-Control"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="no-cache"</span><span style="color: #0000ff;">></span>

link 标签

说到 link 标签,估计大家的第一反应和我一样,就是引入外部CSS样式文件的,不错,这是 link 标签最最常用的功能。不过它还有很多别的用处,比如这是浏览器 favicon 图标,touch图标等等。

<span style="color: #008000;"><!--</span><span style="color: #008000;"> 有助于防止出现内容重复的问题 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="canonical"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/2010/06/9-things-to-do-before-entering-social-media.html"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 之前用于包含 icon 链接,但已被废弃并不再使用 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="shortlink"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/?p=42"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 链接到当前文档的一个 AMP HTML 版本 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="amphtml"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/path/to/amp-version.html"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 表明一个 CSS 样式表 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="stylesheet"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/styles.css"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 链接到一个指定 Web 应用程序&ldquo;安装&rdquo;证书的 JSON 文件 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="manifest"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="manifest.json"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 链接到文档的作者 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="author"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="humans.txt"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 指向一个适用于链接内容的版权申明 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="copyright"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="copyright.html"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 给出可能的你的另一种语言的文档位置参考 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="alternate"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://es.example.com/"</span><span style="color: #ff0000;"> hreflang</span><span style="color: #0000ff;">="es"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 提供了关于作者或其他人的信息 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="me"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://google.com/profiles/thenextweb"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="text/html"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="me"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="mailto:name@example.com"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="me"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="sms:+15035550125"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 链接到一个文档,包含当前文档的一个归档链接 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="archives"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/2003/05/"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="May 2003"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 链接到层次结构中的顶级资源 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="index"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="DeWitt Clinton"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 给出该文档的起点 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="start"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/photos/pattern_recognition_1_about/"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="Pattern Recognition 1"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 引导当前文档的前述资源序列 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="prev"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/opensearch/opensearch-and-openid-a-sure-way-to-get-my-attention/"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="OpenSearch and OpenID? A sure way to get my attention."</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 给出一个自我参考 - 当文档有多个可能的参考时非常有用 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="self"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="application/atom+xml"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/atomFeed.php?page=3"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 分别是在一系列文件中的第一个、下一个、上一个和最后一个 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="first"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/atomFeed.php"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="next"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/atomFeed.php?page=4"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="previous"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/atomFeed.php?page=2"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="last"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/atomFeed.php?page=147"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 当使用第三方服务来维护 blog 时使用 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="EditURI"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/xmlrpc.php?rsd"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="application/rsd+xml"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="RSD"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 当另一个 WordPress 博客链接到你的 WordPress 博客或文章时形成一个自动化的评论 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="pingback"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/xmlrpc.php"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 当你在自己的页面上链接到一个 url 时通知它 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="webmention"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/webmention"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 加载一个外部的 HTML 文件到当前 HTML 文件中 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="import"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="component.html"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 打开搜索 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="search"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="/open-search.xml"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="application/opensearchdescription+xml"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="Search Title"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> Feeds </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="alternate"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://feeds.feedburner.com/example"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="application/rss+xml"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="RSS"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="alternate"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/feed.atom"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="application/atom+xml"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="Atom 0.3"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 预取,预载,预浏览 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="dns-prefetch"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="//example.com/"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="preconnect"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://www.example.com/"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="prefetch"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://www.example.com/"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="prerender"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://example.com/"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="preload"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="image.png"</span><span style="color: #ff0000;"> as</span><span style="color: #0000ff;">="image"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 更多信息:https://css-tricks.com/prefetching-preloading-prebrowsing/ </span><span style="color: #008000;">--></span>

具体说明查看:https://css-tricks.com/prefetching-preloading-prebrowsing/

rss订阅

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="alternate"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="application/rss+xml"</span><span style="color: #ff0000;"> title</span><span style="color: #0000ff;">="RSS"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="/rss.xml"</span> <span style="color: #0000ff;">/></span> <span style="color: #008000;"><!--</span><span style="color: #008000;"> 添加 RSS 订阅 </span><span style="color: #008000;">--></span>

不推荐的link标签

以下是不推荐使用的链接关系:

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="shortcut icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/favicon.ico"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 没有用的, 专有的和错误的, 详见 https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/Y_2eFRh9BOs/gULYapoRBwAJ </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="subresource"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="styles.css"</span><span style="color: #0000ff;">></span>

具体说明查看:https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/Y_2eFRh9BOs/gULYapoRBwAJ

favicon 图标

IE 11, Chrome, Firefox, Safari, Opera支持<link>形式设置:

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/favicon-16.png"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="16x16"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="image/png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/favicon-32.png"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="32x32"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="image/png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/favicon-48.png"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="48x48"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="image/png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/favicon-62.png"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="62x62"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="image/png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/favicon-192.png"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="192x192"</span><span style="color: #ff0000;"> type</span><span style="color: #0000ff;">="image/png"</span><span style="color: #0000ff;">></span>

注意:对于IE 10及以下版本不支持<link>形式设置,只通过将命名为favicon.ico的文件放置在网站根目录中实现。

比较详细的 favicon 介绍可参考:

  • 所有关于网站图标(和触摸图标)
  • favicon 对照表

浏览器及平台详细说明

QQ 浏览器(X5 内核)

QQ 浏览器(X5 内核)同样适用于微信,QQ等第三方应用页面开发。

<span style="color: #008000;"><!--</span><span style="color: #008000;"> 设置锁定横屏、竖屏显示模式,portrait(横屏),landscape(竖屏)</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="x5-orientation"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="portrait|landscape"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 设置全屏显示页面 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="x5-fullscreen"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="true"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 开启页面以应用模式显示(全屏显示等) </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="x5-page-mode"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="app"</span><span style="color: #0000ff;">></span>

360浏览器

设置 360 浏览器渲染模式:webkit 为极速内核,ie-comp 为 IE 兼容内核,ie-stand 为 IE 标准内核。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="renderer"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="webkit|ie-comp|ie-stand"</span><span style="color: #0000ff;">></span>

详情文档链接:浏览器内核控制Meta标签说明文档
360 浏览器就会在读取到这个标签后,立即切换对应的极速核。 另外为了保险起见再加入

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="X-UA-Compatible"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="IE=Edge,chrome=1"</span><span style="color: #0000ff;">></span>

这样写可以达到的效果是如果安装了 Google Chrome Frame,则使用 GCF 来渲染页面,如果没有安装 GCF,则使用最高版本的 IE 内核进行渲染。

UC 浏览器

设置屏幕方向

portrait 为横屏,landscape 为竖屏。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="screen-orientation"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="portrait|landscape"</span><span style="color: #0000ff;">></span>

设置全屏

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="full-screen"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="yes"</span><span style="color: #0000ff;">></span>

设置适应屏幕排版(缩放是否显示滚动条)

UC 浏览器在标准排版效果实现的基础上,提供适应屏幕的排版方式,当设置为 uc-fitscreen=yes,页面进行缩放操作时,仅放大图片和文字等元素,但不放大屏幕宽度,保持不出现水平(横向)滚动条。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="viewport"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="uc-fitscreen=no|yes"</span><span style="color: #0000ff;">></span>

排版模式

UC 浏览器提供两种排版模式,分别是适屏模式(fitscreen)及标准模式(standard),其中适屏模式简化了一些页面的处理,使得页面内容更适合进行页面阅读、节省流量及响应更快,而标准模式则能按照标准规范对页面进行排版及渲染。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="layoutmode"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="fitscreen|standard"</span><span style="color: #0000ff;">></span>

夜间模式

可以帮助用户在低亮度或黑暗情况下更舒适的进行页面浏览。由于基于网页的应用愈加复杂,由浏览器实现的单一夜间模式不一定能够适应所有情况(例如游戏应用),因此 UC 浏览器允许网页设计者对其设计的页面禁用浏览器的夜间模式,自行设计更适合用户使用的夜间模式。

注意:页面内的 frame/iframe 中的夜间模式的 meta 不生效。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="nightmode"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="enable|disable"</span><span style="color: #0000ff;">></span>

整页图片强制显示

为了节省流量及加快速度,UC 为用户提供了无图模式,在实际使用中存在页面中的图片是不可缺少的,例如验证码,地图等。通过强制图片显示的功能可以保证图片显示不受用户的设置影响。

**注意:整页图片强制显示仅对当前页面生效,对页面内的 frame/iframe 不生效,也不影响前进后退的页面

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="imagemode"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="force"</span><span style="color: #0000ff;">></span>

开启应用模式

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="browsermode"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="application"</span><span style="color: #0000ff;">></span>

应用模式是为方便 Web 应用及游戏开发者设置的综合开关,通过meta标签进行指示打开,当进入应用模式时,浏览器将自动调整以下参数:

参数 状态 说明
全屏 生效 可通过 meta 或 JS API 调用退出全屏
长按菜单 失效 可通过 JS API 调用重新生效
浏览器默认手势 失效 可通过 JS API 调用重新生效
排版模式 标准模式 可通过 meta 或 JS API 调用设置其他排版模式
强制图片显示 生效 /
夜间模式 失效 可通过 meta 或 JS API 调用启用夜间模式

缩放字体

例如:禁用的 UC 浏览器的字体缩放功能

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="wap-font-scale"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="no"</span><span style="color: #0000ff;">></span>

具体UC 浏览器文档链接:UC 浏览器文档

Apple iOS原生浏览器

添加智能 App 广告条

告诉浏览器这个网站对应的app,并在页面上显示下载banner,需要注意的是Smart App Banners标签不能用在frame框架内部,否则不起作用。

其中app-id(必须), affiliate-data (可选), app-argument (可选)

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="apple-itunes-app"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT"</span><span style="color: #0000ff;">></span>

例如Digg的写法:

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="apple-itunes-app"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="app-id=362872995, affiliate-data=bevbOqLt02I, app-argument=digg://"</span><span style="color: #0000ff;">></span>

忽略数字自动识别为电话号码

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="format-detection"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="telephone=no"</span><span style="color: #0000ff;">></span>

启用 WebApp 全屏模式

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="apple-mobile-web-app-capable"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="yes"</span><span style="color: #0000ff;">></span>
添加到主屏后设置状态栏的背景颜色
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="apple-mobile-web-app-status-bar-style"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="black"</span><span style="color: #0000ff;">></span>

只有在 “apple-mobile-web-app-capable” content=”yes” 时生效。

  • 如果设置为 default 或 black ,网页内容从状态栏底部开始。
  • 如果设置为 black-translucent ,网页内容充满整个屏幕,顶部会被状态栏遮挡。
添加到主屏后的标题(iOS 6 新增)
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="apple-mobile-web-app-title"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="App Title"</span><span style="color: #0000ff;">></span>

iOS 图标

图片自动处理成圆角和高光等效果。

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/apple-touch-icon.png"</span><span style="color: #0000ff;">></span>

禁止系统自动添加效果,直接显示设计原图。

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon-precomposed"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/apple-touch-icon-precomposed.png"</span><span style="color: #0000ff;">></span>

iOS 8+ 不再支持 precomposed, 只有 apple-touch-icon 是必须的
在大多数情况下,在head中一个180×180px的图标就足够了。如果您想要由设备确定的唯一图标,请使用不同大小的图标。

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="57x57"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/icon@57.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="72x72"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/icon@72.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="114x114"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/icon@114.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="144x144"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/icon@144.png"</span><span style="color: #0000ff;">></span>

启动画面 ( 不赞成使用 )

iPad 的启动画面是不包括状态栏区域的,iPhone 和 iPod touch 的启动画面是包含状态栏区域的

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-startup-image"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/startup.png"</span><span style="color: #0000ff;">></span>

具体描述设置请查看http://www.css88.com/archives/5480中相应的说明。

iOS 应用深度链接

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="apple-itunes-app"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="app-id=APP-ID, app-argument=http/url-sample.com"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="alternate"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="ios-app://APP-ID/http/url-sample.com"</span><span style="color: #0000ff;">></span>

Google Android原生浏览器

标签页选项卡颜色

Android Lollipop 中的 Chrome 39 增加 theme-color meta 标签,用来控制选项卡颜色。

http://updates.html5rocks.com/2014/11/Support-for-theme-color-in-Chrome-39-for-Android

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="theme-color"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="#db5945"</span><span style="color: #0000ff;">></span>

添加到主屏

<span style="color: #008000;"><!--</span><span style="color: #008000;"> 添加到主屏 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="mobile-web-app-capable"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="yes"</span><span style="color: #0000ff;">></span>

详细链接: https://developer.chrome.com/multidevice/android/installtohomescreen

安卓应用深度链接(网页上唤起应用)

<span style="color: #008000;"><!--</span><span style="color: #008000;"> Android app deep linking </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="google-play-app"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="app-id=package-name"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="alternate"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="android-app://package-name/http/url-sample.com"</span><span style="color: #0000ff;">></span>

注:貌似没测试成功,如果你知道如何正确设置,欢迎留言斧正。

Apple Safari 浏览器

Safari 10开始支持固定书签页的SVG favicons了,你可以这样使用:

<span style="color: #008000;"><!--</span><span style="color: #008000;"> Pinned Site </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="mask-icon"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="path/to/icon.svg"</span><span style="color: #ff0000;"> color</span><span style="color: #0000ff;">="red"</span><span style="color: #0000ff;">></span>

类似的效果

扩展阅读:https://yoast.com/dev-blog/safari-pinned-tab-icon-mask-icon/

Google Chrome浏览器

关闭chrome浏览器下翻译插件

有些时候感觉chrome浏览器下翻译插件很烦人,可以通过下面的代码禁用它。

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="google"</span><span style="color: #ff0000;"> value</span><span style="color: #0000ff;">="notranslate"</span> <span style="color: #0000ff;">/></span><span style="font-family: verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.5; background-color: #ffffff;"> </span>

chrome浏览器插件安装

有时候,你需要在你的页面上点击某个安卓,直接安卓你的chrome浏览器插件,而不是链接到Chrome webstore 的详细地址再安装,那么你可以使用:

<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="chrome-webstore-item"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="https://chrome.google.com/webstore/detail/APP_ID"</span><span style="color: #0000ff;">></span>

具体使用,请查看:Using Inline Installation

Google Chrome Mobile (只针对 Android)

从 Chrome 31 开始,你可以设置你的 Web 应用为“app mode”,如 Safari。

<span style="color: #008000;"><!--</span><span style="color: #008000;"> 链接到一个 manifest 并定义 manifest 的元数据。</span><span style="color: #008000;">--></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> manifest.json 中的例子也可以通过以下链接找到。</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="manifest"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="manifest.json"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 定义你的网页为 Web 应用 </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="mobile-web-app-capable"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="yes"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 第一个是官方推荐格式。</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="192x192"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="nice-highres.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="128x128"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="niceicon.png"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 所有带 apple 前缀的格式已废弃,所以不要使用它们。</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="128x128"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="niceicon.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">link </span><span style="color: #ff0000;">rel</span><span style="color: #0000ff;">="apple-touch-icon-precomposed"</span><span style="color: #ff0000;"> sizes</span><span style="color: #0000ff;">="128x128"</span><span style="color: #ff0000;"> href</span><span style="color: #0000ff;">="niceicon.png"</span><span style="color: #0000ff;">></span>

Internet Explorer浏览器

模式设置

//IE8以下以IE7标准模式呈现网页,而IE9则以IE9的标准模式呈现网页:
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7; IE=EmulateIE9">
//如果安装了GCF,则使用GCF来渲染页面("chrome=1"),
//如果没有安装GCF,则使用最高版本的IE内核进行渲染("IE=edge")
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="x-ua-compatible"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="ie=edge"</span><span style="color: #0000ff;">></span>

GCF(Google Chrome Frame )相关链接:https://www.chromium.org/developers/how-tos/chrome-frame-getting-started

X-UA-Compatible相关链接:https://blogs.msdn.microsoft.com/ie/2010/06/16/ies-compatibility-features-for-site-developers/

win8,win10下的一些设置

<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">http-equiv</span><span style="color: #0000ff;">="cleartype"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="on"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="skype_toolbar"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="skype_toolbar_parser_compatible"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 
Disable link highlighting on IE 10 on Windows Phone 
具体说明查看:https://blogs.windows.com/buildingapps/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10/</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-tap-highlight"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="no"</span><span style="color: #0000ff;">></span>
 
<span style="color: #008000;"><!--</span><span style="color: #008000;"> 
Pinned sites
具体说明查看:https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx</span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="application-name"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="Contoso Pinned Site Caption"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-tooltip"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="Example Tooltip Text"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-starturl"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="/"</span><span style="color: #0000ff;">></span>
 
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-config"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="http://example.com/browserconfig.xml"</span><span style="color: #0000ff;">></span>
 
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-allowDomainApiCalls"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="true"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-allowDomainMetaTags"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="true"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-badge"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="frequency=30; polling-uri=http://example.com/id45453245/polling.xml"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-navbutton-color"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="#FF3300"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-notification"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="frequency=60;polling-uri=http://example.com/livetile"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-square150x150logo"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="path/to/logo.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-square310x310logo"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="path/to/largelogo.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-square70x70logo"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="path/to/tinylogo.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-wide310x150logo"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="path/to/widelogo.png"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-task"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="name=Check Order Status;action-uri=./orderStatus.aspx?src=IE9;icon-uri=./favicon.ico"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-task-separator"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="1"</span><span style="color: #0000ff;">></span><span style="color: #000000;">
//Windows 8 磁贴颜色
</span><span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-TileColor"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="#FF3300"</span><span style="color: #0000ff;">></span><span style="color: #000000;">
//Windows 8 磁贴图标
</span><span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-TileImage"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="path/to/tileimage.jpg"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">name</span><span style="color: #0000ff;">="msapplication-window"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="width=1024;height=768"</span><span style="color: #0000ff;">></span>

APP 链接

<span style="color: #008000;"><!--</span><span style="color: #008000;"> iOS </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:ios:url"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="applinks://docs"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:ios:app_store_id"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="12345"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:ios:app_name"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="App Links"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> Android </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:android:url"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="applinks://docs"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:android:app_name"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="App Links"</span><span style="color: #0000ff;">></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:android:package"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="org.applinks"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> Web Fallback </span><span style="color: #008000;">--></span>
<span style="color: #0000ff;"><</span><span style="color: #800000;">meta </span><span style="color: #ff0000;">property</span><span style="color: #0000ff;">="al:web:url"</span><span style="color: #ff0000;"> content</span><span style="color: #0000ff;">="http://applinks.org/documentation"</span><span style="color: #0000ff;">></span>
<span style="color: #008000;"><!--</span><span style="color: #008000;"> More info: http://applinks.org/documentation/ </span><span style="color: #008000;">--></span>

具体请查看:App Links Docs

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn