整合營銷服務(wù)商

          電腦端+手機(jī)端+微信端=數(shù)據(jù)同步管理

          免費(fèi)咨詢熱線:

          不要再封裝各種Util工具類了,這個(gè)神級(jí)框架值得擁有

          不要再封裝各種Util工具類了,這個(gè)神級(jí)框架值得擁有


          utool 諧音 “糊涂”,寓意追求 “萬事都作糊涂觀,無所謂失,無所謂得” 的境界。

          Hutool 是一個(gè) Java 工具包,也只是一個(gè)工具包,它幫助我們簡化每一行代碼,減少每一個(gè)方法,讓 Java 語言也可以 “甜甜的”。Hutool 最初是我項(xiàng)目中 “util” 包的一個(gè)整理,后來慢慢積累并加入更多非業(yè)務(wù)相關(guān)功能,并廣泛學(xué)習(xí)其它開源項(xiàng)目精髓,經(jīng)過自己整理修改,最終形成豐富的開源工具集。(抄自作者簡介)

          功能

          一個(gè) Java 基礎(chǔ)工具類,對(duì)文件、流、加密解密、轉(zhuǎn)碼、正則、線程、XML 等 JDK 方法進(jìn)行封裝,組成各種 Util 工具類,同時(shí)提供以下組件:

          • hutool-aop JDK 動(dòng)態(tài)代理封裝,提供非 IOC 下的切面支持
          • hutool-bloomFilter 布隆過濾,提供一些 Hash 算法的布隆過濾
          • hutool-cache 緩存
          • hutool-core 核心,包括 Bean 操作、日期、各種 Util 等
          • hutool-cron 定時(shí)任務(wù)模塊,提供類 Crontab 表達(dá)式的定時(shí)任務(wù)
          • hutool-crypto 加密解密模塊
          • hutool-db JDBC 封裝后的數(shù)據(jù)操作,基于 ActiveRecord 思想
          • hutool-dfa 基于 DFA 模型的多關(guān)鍵字查找
          • hutool-extra 擴(kuò)展模塊,對(duì)第三方封裝(模板引擎、郵件等)
          • hutool-http 基于 HttpUrlConnection 的 Http 客戶端封裝
          • hutool-log 自動(dòng)識(shí)別日志實(shí)現(xiàn)的日志門面
          • hutool-script 腳本執(zhí)行封裝,例如 Javascript
          • hutool-setting 功能更強(qiáng)大的 Setting 配置文件和 Properties 封裝
          • hutool-system 系統(tǒng)參數(shù)調(diào)用封裝(JVM 信息等)
          • hutool-json JSON 實(shí)現(xiàn)
          • hutool-captcha 圖片驗(yàn)證碼實(shí)現(xiàn)

          簡單測試

          這兩天使用 Hutool 把 Halo 里面的一些代碼給替換掉了,不得不說,用起來十分順心,下面簡單介紹一下我用到的一些 Hutool 的工具類。

          SecureUtil(加密解密工具)

          主要是在登錄的時(shí)候還有修改密碼的時(shí)候用到的,因?yàn)閿?shù)據(jù)庫里面的密碼是 md5 加密處理的,所以登錄的時(shí)候需要先加密之后再到數(shù)據(jù)庫進(jìn)行查詢,使用 Hutool 的話,只需要調(diào)用 SecureUtil 中的 md5 方法就可以了。

          user=userService.userLoginByName(loginName,SecureUtil.md5(loginPwd));
          

          HtmlUtil(HTML 工具類)

          這個(gè)工具類就比較厲害了,不過我在 Halo 當(dāng)中用得最多的還是 HtmlUtil.encode,可以將一些字符轉(zhuǎn)化為安全字符,防止 xss 注入和 SQL 注入,比如下面的評(píng)論提交。

          comment.setCommentAuthor(HtmlUtil.encode(comment.getCommentAuthor()));
          

          這就是防止有小壞蛋故意寫一些可執(zhí)行的 js 代碼,然后提交評(píng)論,在后臺(tái)面板就會(huì)執(zhí)行這一段代碼,比較危險(xiǎn),使用 encode 方法就可以將 標(biāo)簽給轉(zhuǎn)化成,這樣轉(zhuǎn)化之后,js 代碼就不會(huì)執(zhí)行了。

          另外,HtmlUtil 還提供了以下方法,有興趣的可以去試一下。

          • HtmlUtil.restoreEscaped 還原被轉(zhuǎn)義的 HTML 特殊字符
          • HtmlUtil.encode 轉(zhuǎn)義文本中的 HTML 字符為安全的字符
          • HtmlUtil.cleanHtmlTag 清除所有 HTML 標(biāo)簽
          • HtmlUtil.removeHtmlTag 清除指定 HTML 標(biāo)簽和被標(biāo)簽包圍的內(nèi)容
          • HtmlUtil.unwrapHtmlTag 清除指定 HTML 標(biāo)簽,不包括內(nèi)容
          • HtmlUtil.removeHtmlAttr 去除 HTML 標(biāo)簽中的屬性
          • HtmlUtil.removeAllHtmlAttr 去除指定標(biāo)簽的所有屬性
          • HtmlUtil.filter 過濾 HTML 文本,防止 XSS 攻擊

          CronUtil(定時(shí)任務(wù))

          這個(gè)工具就更厲害了,完全不需要類似 quartz 這樣的框架來做定時(shí)任務(wù),而且 CronUtil 也不需要任何其他依賴,只需要在 resources 下建一個(gè)配置文件,然后在程序啟動(dòng)的時(shí)候?qū)⒍〞r(shí)任務(wù)開啟就行了,如 Halo 的定時(shí)備份功能(每天凌晨 1 點(diǎn)備份一次)。

          cron.setting:

          cc.ryanc.halo.web.controller.admin.BackupController.backupResources=0 0 1 * * ?
          cc.ryanc.halo.web.controller.admin.BackupController.backupDatabase=0 0 1 * * ?
          cc.ryanc.halo.web.controller.admin.BackupController.backupPosts=0 0 1 * * ?
          @Override
          public void onApplicationEvent(ContextRefreshedEvent event){
           this.loadActiveTheme();
           this.loadOptions();
           this.loadFiles();
           this.loadThemes();
           //啟動(dòng)定時(shí)任務(wù)
           CronUtil.start();
           log.info("定時(shí)任務(wù)啟動(dòng)成功!");
          }
          

          具體使用方法請(qǐng)看文檔 http://hutool.mydoc.io/?t=255673

          好了,就介紹這三個(gè)工具類,有興趣的可以去試試其他的工具,挺全的,這應(yīng)該是我用過最好用的一個(gè)工具類庫了,值得一試。

          官網(wǎng)地址:http://www.hutool.cn/



          者:Ryan Wang

          ryanc.cc/archives/hutool-java-tools-lib


          簡介

          Hutool是Hu + tool的自造詞,前者致敬我的“前任公司”,后者為工具之意,諧音“糊涂”,寓意追求“萬事都作糊涂觀,無所謂失,無所謂得”的境界。

          Hutool是一個(gè)Java工具包,也只是一個(gè)工具包,它幫助我們簡化每一行代碼,減少每一個(gè)方法,讓Java語言也可以“甜甜的”。Hutool最初是我項(xiàng)目中“util”包的一個(gè)整理,后來慢慢積累并加入更多非業(yè)務(wù)相關(guān)功能,并廣泛學(xué)習(xí)其它開源項(xiàng)目精髓,經(jīng)過自己整理修改,最終形成豐富的開源工具集。(抄自作者簡介)

          功能

          一個(gè)Java基礎(chǔ)工具類,對(duì)文件、流、加密解密、轉(zhuǎn)碼、正則、線程、XML等JDK方法進(jìn)行封裝,組成各種Util工具類,同時(shí)提供以下組件:

          • hutool-aop JDK動(dòng)態(tài)代理封裝,提供非IOC下的切面支持
          • hutool-bloomFilter 布隆過濾,提供一些Hash算法的布隆過濾
          • hutool-cache 緩存
          • hutool-core 核心,包括Bean操作、日期、各種Util等
          • hutool-cron 定時(shí)任務(wù)模塊,提供類Crontab表達(dá)式的定時(shí)任務(wù)
          • hutool-crypto 加密解密模塊
          • hutool-db JDBC封裝后的數(shù)據(jù)操作,基于ActiveRecord思想
          • hutool-dfa 基于DFA模型的多關(guān)鍵字查找
          • hutool-extra 擴(kuò)展模塊,對(duì)第三方封裝(模板引擎、郵件等)
          • hutool-http 基于HttpUrlConnection的Http客戶端封裝
          • hutool-log 自動(dòng)識(shí)別日志實(shí)現(xiàn)的日志門面
          • hutool-script 腳本執(zhí)行封裝,例如Javascript
          • hutool-setting 功能更強(qiáng)大的Setting配置文件和Properties封裝
          • hutool-system 系統(tǒng)參數(shù)調(diào)用封裝(JVM信息等)
          • hutool-json JSON實(shí)現(xiàn)
          • hutool-captcha 圖片驗(yàn)證碼實(shí)現(xiàn)

          簡單測試

          這兩天使用Hutool把Halo里面的一些代碼給替換掉了,不得不說,用起來十分順心,下面簡單介紹一下我用到的一些Hutool的工具類。

          SecureUtil(加密解密工具)

          主要是在登錄的時(shí)候還有修改密碼的時(shí)候用到的,因?yàn)閿?shù)據(jù)庫里面的密碼是md5加密處理的,所以登錄的時(shí)候需要先加密之后再到數(shù)據(jù)庫進(jìn)行查詢,使用Hutool的話,只需要調(diào)用SecureUtil中的md5方法就可以了。

          user = userService.userLoginByName(loginName,SecureUtil.md5(loginPwd));
          

          HtmlUtil(HTML工具類)

          這個(gè)工具類就比較厲害了,不過我在Halo當(dāng)中用得最多的還是HtmlUtil.encode,可以將一些字符轉(zhuǎn)化為安全字符,防止xss注入和SQL注入,比如下面的評(píng)論提交。

          comment.setCommentAuthor(HtmlUtil.encode(comment.getCommentAuthor()));
          

          這就是防止有小壞蛋故意寫一些可執(zhí)行的js代碼,然后提交評(píng)論,在后臺(tái)面板就會(huì)執(zhí)行這一段代碼,比較危險(xiǎn),使用encode方法就可以將<script>標(biāo)簽給轉(zhuǎn)化成<script>,這樣轉(zhuǎn)化之后,js代碼就不會(huì)執(zhí)行了。

          另外,HtmlUtil還提供了以下方法,有興趣的可以去試一下。

          • HtmlUtil.restoreEscaped 還原被轉(zhuǎn)義的HTML特殊字符
          • HtmlUtil.encode 轉(zhuǎn)義文本中的HTML字符為安全的字符
          • HtmlUtil.cleanHtmlTag 清除所有HTML標(biāo)簽
          • HtmlUtil.removeHtmlTag 清除指定HTML標(biāo)簽和被標(biāo)簽包圍的內(nèi)容
          • HtmlUtil.unwrapHtmlTag 清除指定HTML標(biāo)簽,不包括內(nèi)容
          • HtmlUtil.removeHtmlAttr 去除HTML標(biāo)簽中的屬性
          • HtmlUtil.removeAllHtmlAttr 去除指定標(biāo)簽的所有屬性
          • HtmlUtil.filter 過濾HTML文本,防止XSS攻擊
          • CronUtil(定時(shí)任務(wù))

          這個(gè)工具就更厲害了,完全不需要類似quartz這樣的框架來做定時(shí)任務(wù),而且CronUtil也不需要任何其他依賴,只需要在resources下建一個(gè)配置文件,然后在程序啟動(dòng)的時(shí)候?qū)⒍〞r(shí)任務(wù)開啟就行了,如Halo的定時(shí)備份功能(每天凌晨1點(diǎn)備份一次)。

          cron.setting:

          cc.ryanc.halo.web.controller.admin.BackupController.backupResources = 0 0 1 * * ?
          cc.ryanc.halo.web.controller.admin.BackupController.backupDatabase = 0 0 1 * * ?
          cc.ryanc.halo.web.controller.admin.BackupController.backupPosts = 0 0 1 * * ?
          


          @Override
          public void onApplicationEvent(ContextRefreshedEvent event){
              this.loadActiveTheme();
              this.loadOptions();
              this.loadFiles();
              this.loadThemes();
              //啟動(dòng)定時(shí)任務(wù)
              CronUtil.start();
              log.info("定時(shí)任務(wù)啟動(dòng)成功!");
          }
          

          好了,就介紹這三個(gè)工具類,有興趣的可以去試試其他的工具,挺全的,這應(yīng)該是我用過最好用的一個(gè)工具類庫了,值得一試。

          官網(wǎng)地址:http://www.hutool.cn/

          小推薦

          下面是基本的、最低限度的網(wǎng)站基本標(biāo)簽:

          <meta charset="utf-8">
          <meta http-equiv="x-ua-compatible" content="ie=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><!-- 以上 3 個(gè) meta 標(biāo)簽 *必須* 放在 head 的最前面;其他任何的 head 內(nèi)容必須在這些標(biāo)簽的 *后面* --><title>頁面標(biāo)題</title>

          網(wǎng)頁元素

          <!-- 文檔標(biāo)題 --><title>頁面標(biāo)題</title><!-- 基本 URL 作用于文檔中所包含的所有相對(duì) URL --><base ><!-- 外部的 CSS --><link rel="stylesheet" href="styles.css"><!-- 文檔內(nèi)的 CSS --><style> /* ... */</style><!-- JavaScript --><script src="script.js"></script>
          <noscript><!--無 JS 時(shí)的替代--></noscript>

          Meta 標(biāo)簽

          <!-- 設(shè)置文檔的字符編碼 --><meta charset="utf-8">
          <meta http-equiv="x-ua-compatible" content="ie=edge">
          <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"><!-- 以上 3 個(gè) meta 標(biāo)簽 *必須* 放在 head 的最前面;其他任何的 head 內(nèi)容必須在這些標(biāo)簽的 *后面* --><!-- 允許控制資源的過度加載 --><meta http-equiv="Content-Security-Policy" content="default-src 'self'"><!-- 盡早地放置在文檔中 --><!-- 僅應(yīng)用于該標(biāo)簽下的內(nèi)容 --><!-- Web 應(yīng)用的名稱(僅當(dāng)網(wǎng)站被用作為一個(gè)應(yīng)用時(shí)才使用)--><meta name="application-name" content="應(yīng)用名稱"><!-- 針對(duì)頁面的簡短描述(限制 150 字符)--><!-- 在*某些*情況下,該描述是被用作搜索結(jié)果展示片段的一部分 --><meta name="description" content="一個(gè)頁面描述"><!-- 控制搜索引擎的抓取和索引行為 --><meta name="robots" content="index,follow"><!-- 所有搜索引擎 --><meta name="googlebot" content="index,follow"><!-- 僅對(duì) Google 有效 --><!-- 告訴 Google 不顯示網(wǎng)站鏈接的搜索框 --><meta name="google" content="nositelinkssearchbox"><!-- 告訴 Google 不提供此頁面的翻譯 --><meta name="google" content="notranslate"><!-- 驗(yàn)證 Google 搜索控制臺(tái)的所有權(quán) --><meta name="google-site-verification" content="verification_token"><!-- 驗(yàn)證 Yandex 網(wǎng)站管理員的所有權(quán) --><meta name="yandex-verification" content="verification_token"><!-- 驗(yàn)證 Bing 網(wǎng)站管理員中心的所有權(quán) --><meta name="msvalidate.01" content="verification_token"><!-- 驗(yàn)證 Alexa 控制臺(tái)的所有權(quán) --><meta name="alexaVerifyID" content="verification_token"><!-- 驗(yàn)證 Pinterest 控制臺(tái)的所有權(quán) --><meta name="p:domain_verify" content="code from pinterest"><!-- 驗(yàn)證 Norton 安全站點(diǎn)的所有權(quán) --><meta name="norton-safeweb-site-verification" content="norton code"><!-- 用來命名軟件或用于構(gòu)建網(wǎng)頁(如 - WordPress、Dreamweaver)--><meta name="generator" content="program"><!-- 關(guān)于你的網(wǎng)站主題的簡短描述 --><meta name="subject" content="你的網(wǎng)站主題"><!-- 基于網(wǎng)站內(nèi)容給出一般的年齡分級(jí) --><meta name="rating" content="General"><!-- 允許控制 referrer 信息如何傳遞 --><meta name="referrer" content="no-referrer"><!-- 禁用自動(dòng)檢測和格式化可能的電話號(hào)碼 --><meta name="format-detection" content="telephone=no"><!-- 通過設(shè)置為 “off” 完全退出 DNS 預(yù)取 --><meta http-equiv="x-dns-prefetch-control" content="off"><!-- 在客戶端存儲(chǔ) cookie,web 瀏覽器的客戶端識(shí)別 --><meta http-equiv="set-cookie" content="name=value; expires=date; path=url"><!-- 指定要顯示在一個(gè)特定框架中的頁面 --><meta http-equiv="Window-Target" content="_value"><!-- 地理標(biāo)簽 --><meta name="ICBM" content="latitude, longitude">
          <meta name="geo.position" content="latitude;longitude">
          <meta name="geo.region" content="country[-state]"><!-- 國家代碼 (ISO 3166-1): 強(qiáng)制性, 州代碼 (ISO 3166-2): 可選; 如 content="US" / content="US-NY" --><meta name="geo.placename" content="city/town"><!-- 如 content="New York City" -->

          鏈接

          <!-- 表明一個(gè) CSS 樣式表 --><link rel="stylesheet" ><!-- 有助于防止出現(xiàn)內(nèi)容重復(fù)的問題 --><link rel="canonical" ><!-- 之前用于包含 icon 鏈接,但已被廢棄并不再使用 --><link rel="shortlink" ><!-- 鏈接到當(dāng)前文檔的一個(gè) AMP HTML 版本 --><link rel="amphtml" ><!-- 鏈接到一個(gè)指定 Web 應(yīng)用程序“安裝”證書的 JSON 文件 --><link rel="manifest" href="manifest.json"><!-- 鏈接到文檔的作者 --><link rel="author" href="humans.txt"><!-- 指向一個(gè)適用于鏈接內(nèi)容的版權(quán)申明 --><link rel="license" href="copyright.html"><!-- 給出可能的你的另一種語言的文檔位置參考 --><link rel="alternate"  hreflang="es"><!-- 提供了關(guān)于作者或其他人的信息 --><link rel="me"  type="text/html">
          <link rel="me" href="mailto:name@example.com">
          <link rel="me" href="sms:+15035550125"><!-- 鏈接到一個(gè)描述歷史記錄、文檔或其他具有歷史意義的材料的集合的文檔。 --><link rel="archives" ><!-- 鏈接到層次結(jié)構(gòu)中的頂級(jí)資源 --><link rel="index" ><!-- 給出一個(gè)自我參考 - 當(dāng)文檔有多個(gè)可能的參考時(shí)非常有用 --><link rel="self" type="application/atom+xml" ><!-- 分別是在一系列文件中的第一個(gè)、下一個(gè)、上一個(gè)和最后一個(gè) --><link rel="first" >
          <link rel="next" >
          <link rel="prev" >
          <link rel="last" ><!-- 當(dāng)使用第三方服務(wù)來維護(hù) blog 時(shí)使用 --><link rel="EditURI"  type="application/rsd+xml" title="RSD"><!-- 當(dāng)另一個(gè) WordPress 博客鏈接到你的 WordPress 博客或文章時(shí)形成一個(gè)自動(dòng)化的評(píng)論 --><link rel="pingback" ><!-- 當(dāng)你在自己的頁面上鏈接到一個(gè) url 時(shí)通知它 --><link rel="webmention" ><!-- 加載一個(gè)外部的 HTML 文件到當(dāng)前 HTML 文件中 --><link rel="import" href="/path/to/component.html"><!-- 打開搜索 --><link rel="search" href="/open-search.xml" type="application/opensearchdescription+xml" title="Search Title"><!-- Feeds --><link rel="alternate"  type="application/rss+xml" title="RSS">
          <link rel="alternate"  type="application/atom+xml" title="Atom 0.3"><!-- 預(yù)取,預(yù)載,預(yù)瀏覽 --><link rel="dns-prefetch" >
          <link rel="preconnect" >
          <link rel="prefetch" >
          <link rel="prerender" >
          <link rel="preload" href="image.png" as="image"><!-- 更多信息:https://css-tricks.com/prefetching-preloading-prebrowsing/ -->

          網(wǎng)站圖標(biāo)

          <!-- 針對(duì) IE 10 及以下版本 --><!-- 如果將 `favicon.ico` 放在根目錄下,則無需標(biāo)簽 --><!-- 對(duì)于 IE 11、Chrome、Firefox、Safari 和 Opera --><link rel="icon" type="image/png" sizes="16x16" href="/path/to/favicon-16x16.png">
          <link rel="icon" type="image/png" sizes="32x32" href="/path/to/favicon-32x32.png">
          <link rel="icon" type="image/png" sizes="96x96" href="/path/to/favicon-96x96.png"><!-- 更多信息: https://bitsofco.de/all-about-favicons-and-touch-icons/ -->

          社交

          Facebook Open Graph

          <meta property="fb:app_id" content="123456789">
          <meta property="og:url" content="https://example.com/page.html">
          <meta property="og:type" content="website">
          <meta property="og:title" content="Content Title">
          <meta property="og:image" content="https://example.com/image.jpg">
          <meta property="og:description" content="Description Here">
          <meta property="og:site_name" content="Site Name">
          <meta property="og:locale" content="en_US">
          <meta property="article:author" content="">

          Facebook Instant Articles

          <meta charset="utf-8">
          <meta property="op:markup_version" content="v1.0"><!-- 你的文章的 Web 版網(wǎng)址 --><link rel="canonical" ><!-- 用于該文章的樣式 --><meta property="fb:article_style" content="myarticlestyle">

          Twitter Cards

          <meta name="twitter:card" content="summary">
          <meta name="twitter:site" content="@site_account">
          <meta name="twitter:creator" content="@individual_account">
          <meta name="twitter:url" content="https://example.com/page.html">
          <meta name="twitter:title" content="Content Title">
          <meta name="twitter:description" content="Content description less than 200 characters">
          <meta name="twitter:image" content="https://example.com/image.jpg">

          Google+ / Schema.org

          <link  rel="publisher">
          <meta itemprop="name" content="內(nèi)容標(biāo)題">
          <meta itemprop="description" content="內(nèi)容描述少于 200 個(gè)字符">
          <meta itemprop="image" content="https://example.com/image.jpg">

          Pinterest

          根據(jù)他們的幫助中心可知,Pinterest 允許你禁止他人保存你網(wǎng)站里的內(nèi)容。description 為可選。

          <meta name="pinterest" content="nopin" description="Sorry, you can't save from my website!">

          OEmbed

          <link rel="alternate" type="application/json+oembed"
          
          title="oEmbed Profile: JSON">
          <link rel="alternate" type="text/xml+oembed"
          
          title="oEmbed Profile: XML">

          瀏覽器 / 平臺(tái)

          Apple iOS

          <!-- 智能應(yīng)用 Banner --><meta name="apple-itunes-app" content="app-id=APP_ID,affiliate-data=AFFILIATE_ID,app-argument=SOME_TEXT"><!-- 禁用自動(dòng)檢測和格式化可能的電話號(hào)碼 --><meta name="format-detection" content="telephone=no"><!-- 添加到主屏幕 --><meta name="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="應(yīng)用標(biāo)題"><!-- 觸摸圖標(biāo) --><!-- 在大多數(shù)情況下,在 `<head>` 中,一個(gè) 180×180px 觸摸圖標(biāo)就已經(jīng)足夠了 --><link rel="apple-touch-icon" href="/path/to/apple-touch-icon.png"><!-- 注意:iOS 7 上的 Safari 不會(huì)對(duì)圖標(biāo)產(chǎn)生效果。 --><!-- 較早版本的 Safari 不會(huì)對(duì)以 `-precomposed.png` 后綴命名的圖標(biāo)文件產(chǎn)生效果。 --><!-- 啟動(dòng)畫面(已無效) --><link rel="apple-touch-startup-image" href="path/to/startup.png"><!-- iOS 應(yīng)用深層鏈接 --><meta name="apple-itunes-app" content="app-id=APP-ID, app-argument=http/url-sample.com">
          <link rel="alternate" href="ios-app://APP-ID/http/url-sample.com">

          Apple Safari

          <!-- 固定網(wǎng)站 --><link rel="mask-icon" href="path/to/icon.svg" color="red">

          Google Android

          <meta name="theme-color" content="#E64545"><!-- 添加到主屏幕 --><meta name="mobile-web-app-capable" content="yes"><!-- 更多信息:https://developer.chrome.com/multidevice/android/installtohomescreen -->

          Google Chrome

          <link rel="chrome-webstore-item" ><!-- 禁用翻譯提示 --><meta name="google" content="notranslate">

          Google Chrome Mobile (只針對(duì) Android)

          從 Chrome 31 開始,你可以設(shè)置你的 Web 應(yīng)用為“app mode”,如 Safari。

          <!-- 鏈接到一個(gè) manifest 并定義 manifest 的元數(shù)據(jù)。--><!-- manifest.json 中的例子也可以通過以下鏈接找到。--><link rel="manifest" href="manifest.json"><!-- 定義你的網(wǎng)頁為 Web 應(yīng)用 --><meta name="mobile-web-app-capable" content="yes"><!-- 主屏幕圖標(biāo) --><link rel="icon" sizes="192x192" href="highres-icon.png">

          Microsoft Internet Explorer

          <meta http-equiv="x-ua-compatible" content="ie=edge">
          <meta name="skype_toolbar" content="skype_toolbar_parser_compatible"><!-- IE10: 禁用鏈接點(diǎn)擊高亮 (https://blogs.windows.com/buildingapps/2012/11/15/adapting-your-webkit-optimized-site-for-internet-explorer-10/) --><meta name="msapplication-tap-highlight" content="no"><!-- 固定網(wǎng)站 (https://msdn.microsoft.com/en-us/library/dn255024(v=vs.85).aspx) --><meta name="application-name" content="Sample Title">
          <meta name="msapplication-tooltip" content="A description of what this site does.">
          <meta name="msapplication-starturl" content="http://example.com/index.html?pinned=true">
          <meta name="msapplication-navbutton-color" content="#FF3300">
          <meta name="msapplication-window" content="width=800;height=600">
          <meta name="msapplication-task" content="name=Task 1;action-uri=http://host/Page1.html;icon-uri=http://host/icon1.ico">
          <meta name="msapplication-task" content="name=Task 2;action-uri=http://microsoft.com/Page2.html;icon-uri=http://host/icon2.ico">
          <meta name="msapplication-badge" value="frequency=NUMBER_IN_MINUTES;polling-uri=http://example.com/path/to/file.xml">
          <meta name="msapplication-TileColor" content="#FF3300">
          <meta name="msapplication-TileImage" content="path/to/tileimage.jpg">
          <meta name="msapplication-config" content="http://example.com/browserconfig.xml">
          <meta name="msapplication-notification" content="frequency=60;polling-uri=http://example.com/livetile;polling-uri2=http://example.com/livetile2">
          <meta name="msapplication-task-separator" content="1">

          應(yīng)用鏈接

          <!-- 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 回退 --><meta property="al:web:url" content="http://applinks.org/documentation"><!-- 更多信息:http://applinks.org/documentation/ -->

          國內(nèi)的瀏覽器

          360 瀏覽器

          <!-- 選擇渲染引擎 --><meta name="renderer" content="webkit|ie-comp|ie-stand">

          QQ 移動(dòng)瀏覽器

          <!-- 在指定方向上鎖定屏幕(鎖定橫/豎屏) --><meta name="x5-orientation" content="landscape/portrait"><!-- 全屏顯示此頁面 --><meta name="x5-fullscreen" content="true"><!-- 頁面將以“應(yīng)用模式”顯示(全屏等)--><meta name="x5-page-mode" content="app">

          UC 移動(dòng)瀏覽器

          <!-- 在指定方向上鎖定屏幕(鎖定橫/豎屏) --><meta name="screen-orientation" content="landscape/portrait"><!-- 全屏顯示此頁面 --><meta name="full-screen" content="yes"><!-- 即使在“文本模式”下,UC 瀏覽器也會(huì)顯示圖片 --><meta name="imagemode" content="force"><!-- 頁面將以“應(yīng)用模式”顯示(全屏、禁止手勢等) --><meta name="browsermode" content="application"><!-- 在此頁面禁用 UC 瀏覽器的“夜間模式” --><meta name="nightmode" content="disable"><!-- 簡化頁面,減少數(shù)據(jù)傳輸 --><meta name="layoutmode" content="fitscreen"><!-- 禁用的 UC 瀏覽器的功能,“當(dāng)此頁面中有較多文本時(shí)縮放字體” --><meta name="wap-font-scale" content="no">

          注意

          性能

          當(dāng)啟用 GZIP 時(shí),移動(dòng) href 屬性到該元素的開頭以提高壓縮,因?yàn)?href 屬性被用于 abaselink 標(biāo)簽。

          示例:

          <link  rel="stylesheet">

          主站蜘蛛池模板: 一区精品麻豆入口| 久久精品一区二区三区四区| 免费人妻精品一区二区三区| 精品视频一区二区三区免费| 精品日韩一区二区| 精品一区精品二区制服| 免费精品一区二区三区第35| 人妻无码一区二区视频| 成人国产精品一区二区网站公司| 久久久久人妻精品一区蜜桃| 曰韩精品无码一区二区三区| 波多野结衣高清一区二区三区 | 国产韩国精品一区二区三区| 亚洲一区二区三区写真| 无码人妻精品一区二区三区蜜桃| 日韩一区精品视频一区二区| 国产AV一区二区三区无码野战| 精品国产一区二区三区久久蜜臀| 一区二区三区四区在线观看视频| 国产一区二区三区在线看片 | 国产精品熟女视频一区二区| 无码国产精品一区二区免费| 亚洲av无码片vr一区二区三区| 亚洲福利视频一区二区三区| 国产精品一区在线播放| 无码精品一区二区三区| 国产日韩精品一区二区三区| 国产一区二区精品久久91| 国产一区二区三区播放| 久久久人妻精品无码一区| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 无码日韩精品一区二区免费暖暖| 亚洲一区爱区精品无码| 性无码免费一区二区三区在线 | 亚洲午夜一区二区电影院| 69久久精品无码一区二区| 日韩aⅴ人妻无码一区二区| 一区 二区 三区 中文字幕| 国语精品一区二区三区| 中文字幕在线一区二区在线| 天堂Av无码Av一区二区三区|