JS 中文亂碼

來源:互聯網
上載者:User

網頁裡<head>加上這一行
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

 

meta是html語言head區的一個輔助性標籤。幾乎所有的網頁裡,我們可以看到類似下面這段的html代碼:
<head>
<meta http-equiv="content-Type" content="text/html; charset=gb2312">
</head>
也許你認為這些代碼可有可無。其實如果你能夠用好meta標籤,會給你帶來意想不到的效果,例如加入關鍵字會自動被大型搜尋網站自動搜集;可以設定頁面格式及重新整理等等。
一、meta標籤的組成
meta標籤共有兩個屬性,它們分別是http-equiv屬性和name屬性,不同的屬性又有不同的參數值,這些不同的參數值就實現了不同的網頁功能。
1、name屬性
name屬性主要用於描述網頁,與之對應的屬性值為content,content中的內容主要是便於搜尋引擎機器人尋找資訊和分類資訊用的。
meta標籤的name屬性文法格式是:<meta name="參數" content="具體的參數值"> 。
其中name屬性主要有以下幾種參數:
A、Keywords(關鍵字)
說明:keywords用來告訴搜尋引擎你網頁的關鍵字是什麼。
舉例:<meta name ="keywords" content="science, education,culture,politics,ecnomics,relationships, entertaiment, human">
B、description(網站內容描述)
說明:description用來告訴搜尋引擎你的網站主要內容。
舉例:<meta name="description" content="This page is about the meaning of science, education,culture.">
C、robots(機器人嚮導)
說明:robots用來告訴搜尋機器人哪些頁面需要索引,哪些頁面不需要索引。
content的參數有all,none,index,noindex,follow,nofollow。預設是all。
舉例:<meta name="robots" content="none">
D、author(作者)
說明:標註網頁的作者
舉例:<meta name="author" content"root,root@21cn.com">

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.