Introduction to the use of http-equiv attribute in meta tag

Introduction to the use of http-equiv attribute in meta tag
meta is an auxiliary tag in the head area of ​​html language. Maybe you think these codes are unnecessary. In fact, if you can make good use of meta tags, it will bring you unexpected results. The functions of meta tags include: search engine optimization (SEO), defining the language used by the page, automatically refreshing and pointing to new pages, achieving dynamic effects when converting web pages, controlling page buffering, web page rating and evaluation, controlling the window in which the web page is displayed, etc.!

Composition of meta tag : meta tag has two attributes, namely http-equiv attribute and name attribute. Different attributes have different parameter values, and these different parameter values ​​realize different web page functions.

1. Name attribute

The name attribute is mainly used to describe the web page. The corresponding attribute value is content. The content in content is mainly used to facilitate search engine robots to find and classify information.

The name attribute syntax of the meta tag is:

<metaname="parameter" content="specific parameter value">.

The name attribute mainly has the following parameters:

A. Keywords

Description: Keywords are used to tell search engines what the keywords of your web page are.

Example: <metaname="keywords" content="science,education,culture,politics,ecnomics,relationships,entertaiment,human">

B. description (website content description)

Description: Description is used to tell search engines the main content of your website.

Example: <metaname="description" content="This page is about the meaning of science, education, culture."">

C. robots (robot guides)

Description: robots are used to tell search robots which pages need to be indexed and which pages do not need to be indexed.

The parameters of content are all, none, index, noindex, follow, and nofollow. The default is all.

Example: <metaname="robots" content="none">

D. author

Description: Mark the author of the web page

Example: <metaname="author" content="root,[email protected]">

2. http-equiv attribute

As the name suggests, http-equiv is equivalent to the file header of http. It can transmit some useful information back to the browser to help display the content of the web page correctly and accurately. The corresponding attribute value is content. The content in content is actually the variable value of each parameter.

The syntax format of the http-equiv attribute of the meta tag is:

<metahttp-equiv="parameter" content="parameter variable value">;

The http-equiv attribute mainly has the following parameters:

A. Expires

Description: Can be used to set the expiration time of a web page. Once a web page expires, it must be retransmitted to the server.

Usage: <metahttp-equiv="expires" content="Fri,12Jan200118:18:18GMT">

Note: The time format must be GMT.

B. Pragma (cache mode)

Description: Prevents the browser from accessing page content from the local computer's cache.

Usage: <metahttp-equiv="Pragma" content="no-cache">

Note: With this setting, visitors will not be able to browse offline.

C. Refresh

Description: Automatically refresh and point to a new page.

Usage: <metahttp-equiv="Refresh" content="2;URL=https://www.jb51.net"> (note the quotation marks at the end, which are before the seconds and after the URL)

Note: The 2 means that it will automatically refresh to the URL after staying for 2 seconds.

D. Set-Cookie (cookie setting)

Note: If the web page expires, the saved cookies will be deleted.

Usage: <metahttp-equiv="Set-Cookie" content="cookievalue=xxx;expires=Friday,12-Jan-200118:18:18GMT;path=/">

Note: The time format must be GMT.

E. Window-target (display window settings)

Description: Force the page to be displayed as an independent page in the current window.

Usage: <metahttp-equiv="Window-target" content="_top">

Note: Used to prevent others from calling your own pages in the frame.

F. content-Type (display character set settings)

Description: Set the character set used by the page.

Usage: <metahttp-equiv="content-Type" content="text/html;charset=gb2312">

G. content-Language (display language setting)

Usage: <metahttp-equiv="Content-Language" content="zh-cn"/>

H. Cache-Control specifies the cache mechanism followed by requests and responses.
Cache-Control specifies the cache mechanism that the request and response follow. Setting Cache-Control in a request or response message does not modify the cache handling of the other message. The cache directives during the request include no-cache, no-store, max-age, max-stale, min-fresh, on

ly-if-cached, the instructions in the response message include public, private, no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, and max-age. The meaning of the instructions in each message is as follows
Public indicates that the response can be cached by any cache
Private indicates that the entire or partial response message for a single user cannot be processed by the shared cache. This allows the server to describe only part of the response message to the current user, which is not valid for other users' requests.
no-cache indicates that the request or response message cannot be cached
no-store is used to prevent important information from being accidentally released. Sending it in a request message will cause both the request and response messages to not use the cache.
max-age indicates that the client can accept responses with an age no greater than the specified time (in seconds).
min-fresh indicates that the client can receive responses whose response time is less than the current time plus the specified time
max-stale indicates that the client can receive response messages beyond the timeout period. If you specify a max-stale message value, the client can receive response messages that exceed the specified timeout period.

Meta tag usage tips :

Meta tags are a language used to describe the properties of web pages. Standard Meta tags can facilitate search engine sorting and improve the search engine website weight ranking. If you want to make your website more in line with search engine standards, you must understand meta tags. Here, Seoer Xiyuan will tell you the meaning and usage of meta tags:

1. Keywords in the META tag

The writing method is: <metaname="Keywords" content="Information parameters"/>

The information parameter of Keywords in the meat tag represents what the keywords of the website are.

2. Description of META tag

<metaname="Description" content="Information parameters"/>

The Description parameter of the meta tag represents the main content and overview of the website.

3. http-equiv=Content-Typecontent="text/html" of the META tag

http-equiv=Content-Type represents the HTTP header protocol, which indicates the information of the web page to the browser.

<metahttp-equiv="Content-Type" content="text/html; charset=information parameter"/>

When the charset parameter of the meta tag is GB2312, it means that the encoding used by the website is simplified Chinese.

When the charset parameter of the meta tag is BIG5, it means that the encoding used by the website is Traditional Chinese.

When the charset parameter of the meta tag is iso-2022-jp, it means that the encoding used by the website is Japanese;

When the charset information parameter of the meta tag is ks_c_5601, it means that the encoding used by the website is Korean;

When the charset parameter of the meta tag is ISO-8859-1, it means that the encoding used by the website is English.

When the charset information parameter of the meta tag is UTF-8, it represents the universal language encoding;

4. META tag generator

<metaname="generator" content="Information parameters"/>

The generator information parameter of the meta tag indicates what software was used to create the website.

5. Author in the META tag

<metaname="author"content="information parameters">

The author information parameter of the meta tag represents the copyright author information of the web page.

6. http-equiv="Refresh" in the META tag

<Metahttp-equiv="Refresh"Content="Time;Url=URL parameter">

The Refresh in the meta tag represents how long the webpage will automatically refresh, and combined with the URL parameter in the Url, it represents how long it will automatically link to other URLs.

7. HTTP-EQUIV="Pragma"CONTENT="no-cache" in the META tag

<METAHTTP-EQUIV="Pragma"CONTENT="no-cache"> means prohibiting the browser from accessing the page content from the cache of the local computer. With this setting, visitors will not be able to browse offline.

8. COPYRIGHT of META tag

<METANAME="COPYRIGHT"CONTENT="Information parameters">

The COPYRIGHT information parameter of the meta tag represents the copyright information of the website.

9. http-equiv="imagetoolbar" in the META tag

<metahttp-equiv="imagetoolbar" content="false"/>

Specifies whether to display the image toolbar. When false, it means it is not displayed, and when true, it means it is displayed.

10. Content-Script-Type of the META tag

<Metahttp-equiv="Content-Script-Type"Content="text/javascript">

W3C web page specification that specifies the type of scripts in a page.

11. META tag revisit-after

<METAname="revisit-after"CONTENT="7days">

revisit-after means revisiting the website, 7days means 7 days, and so on.

12. Robots in META tag <metaname="Robots"contect="information parameters">

Robots tells search engine robots which pages to crawl

The properties are described as follows :

The information parameter is all: the files will be retrieved and the links on the page can be queried;

The information parameter is none: the file will not be retrieved, and the links on the page cannot be queried;

The information parameter is index: the file will be retrieved;

The information parameter is follow: the links on the page can be queried;

The information parameter is noindex: the file will not be indexed, but the links on the page can be queried;

The information parameter is nofollow: the file will be retrieved, but the links on the page will not be queried;

<<:  Personalized and creative website design examples (30)

>>:  Vue Basic Tutorial: Conditional Rendering and List Rendering

Recommend

Introduction to the use and difference between in and exists in MySQL

First put a piece of code for(int i=0;i<1000;i...

Detailed explanation of Linux server status and performance related commands

Server Status Analysis View Linux server CPU deta...

Detailed analysis of Vue child components and parent components

Table of contents 1. Parent components and child ...

Detailed graphic tutorial on installing centos7 virtual machine in Virtualbox

1. Download centos7 Download address: https://mir...

MySQL series of experience summary and analysis tutorials on NUll values

Table of contents 1. Test Data 2. The inconvenien...

JavaScript Factory Pattern Explained

Table of contents Simple Factory Factory Method S...

Implementation of select multiple data loading optimization in Element

Table of contents Scenario Code Implementation Su...

Detailed explanation of identifying files with the same content on Linux

Preface Sometimes file copies amount to a huge wa...

The use of textarea in html and common problems and case analysis

The textarea tag is an HTML tag that we often use....

Detailed explanation of 7 SSH command usages in Linux that you don’t know

A system administrator may manage multiple server...

Complete Tutorial on Deploying Java Web Project on Linux Server

Most of this article refers to other tutorials on...