Home Web Front-end HTML Tutorial Detailed explanation of meta columns in HTML5 WEB interface

Detailed explanation of meta columns in HTML5 WEB interface

Jan 17, 2018 am 09:41 AM
html5 meta web

This time I will bring you a detailed explanation of the meta column in the HTML5 WEB interface. What are the precautions for using the meta in the HTML5 WEB interface? The following is a practical case, let's take a look.

Introduction

The meta tag is an auxiliary tag in the HEAD area of ​​the HTML language.

meta is often used to define page descriptions, keywords, last modified date, and other metadata. This metadata will serve browsers (how the page is laid out or reloaded), search engines and other web services.

mata tag contains global attributes

charset

Declares the character encoding of the web page:

content

The content of the content attribute is the value of the htp-equiv or name attribute, depending on which one you use.

http-equiv

This attribute can contain the name of the HTTP header. The full English name of the attribute is http-equivalent. It defines directives that can change the behavior of server and user-agent. The value of this directive is defined within the content attribute and can be one of the following:

content-language (obsolete)

Defines the default language for the page. It can be overridden by the lang attribute on any element.

Pragma

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

expires

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

cache-control

Specifies the caching mechanism that requests and responses follow. There are several usages:

no-cache: Send a request first and confirm with the server whether the resource has been changed. If not, use cache.
no-store: No caching is allowed. You have to go to the server every time and download the complete response. (Security measure)
public : All responses are cached, but are not required. Because max-age can also achieve the same effect
private: only cached for a single user, so no relay is allowed to cache. (For example, CDN does not allow caching of private responses)
max-age: Indicates how long the response can be cached and reused starting from the current request without re-requesting the server. For example: max-age=60 means that the response can be cached and reused for another 60 seconds.

content-security-policy

Allows page authors to define the content policy for the current page. Content policies primarily specify allowed server addresses and scripting endpoints, which help prevent cross-site scripting attacks.

The essence of CSP is the whitelist system. The developer clearly tells the client which external resources can be loaded and executed, which is equivalent to providing a whitelist. Its implementation and execution are all completed by the browser, and developers only need to provide configuration.

CSP greatly enhances the security of web pages. Even if an attacker discovers a vulnerability, he or she cannot inject a script unless he also controls a whitelisted, trusted host. There are two ways to enable CSP. One is through the Content-Security-Policy field of the HTTP header.

Content-Security-Policy: script-src 'self'; object-src 'none';

style-src cdn.example.org third-party.org;child-src https :



##In the above code, CSP has the following configuration:

Script: Only trust the current domain name

Tag: Do not trust any URL, that is, do not load any resources
Style sheet: Only trust cdn.example.org and third-party.org
Framework (frame): Must use HTTPS protocol to load
Other resources: No restrictions
When enabled, external resources that do not comply with CSP will be blocked from loading.

More introductions can be found: Content Security Policy Getting Started Tutorial

content-type (obsolete)

Define the MIME type of the document, followed by its character encoding.

Do not use this value as it is obsolete. It is recommended to use the charset attribute on the element.

Since the document type cannot be changed in XHTML serialization for XHTML or HTML5, do not use the Set MIME type to the XHTML MIME type.
refresh

This directive specifies:

If the content attribute contains only a positive integer, it indicates the number of seconds for the page to be reloaded.

If the content attribute contains a positive integer, followed by the
string '; url =', it means that the current page will be redirected to another valid URL after XX seconds.

robots

Robots are used to tell the crawler which pages need to be indexed and which pages do not need to be indexed.



##Value

Used By

##index Allowed Robot index this page (default) All

noindex Do not allow robot to index this page All

follow Allow search engines to continue to search other web pages through the link index of this page (default) All

nofollow Search engines do not continue to search other web pages through the link index of this web page All

none Equivalent to noindex, nofollow Google

noodp Prohibits the use of Open Directory Project descriptions (if any) ) as a page description in search engine results. Google, Yahoo, Bing

noarchive Requires search engines not to cache page content Google, Yahoo, Bing

nosnippet Prohibits any description of the page from being displayed in search engine results. Google, Bing

noimageindex Requests that this page not be displayed as an index image of the referencing page. Google

nocache Synonymous with noarchive Bing

viewport

Provides hints about the size of the initial size of the viewport. For mobile use only.

I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!

Related reading:

How to insert a video into an HTML webpage

How to make an HTML text box read-only effect

How to make the front-end interface automatically clear the cache of js and css files

The above is the detailed content of Detailed explanation of meta columns in HTML5 WEB interface. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

Moving Text in HTML Moving Text in HTML Sep 04, 2024 pm 04:45 PM

Guide to Moving Text in HTML. Here we discuss an introduction, how marquee tag work with syntax and examples to implement.

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles