Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to define a metadata in html5

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to define a metadata in html5". Many people will encounter this dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

1. Attribute charset, which directly specifies the page encoding.

Specify name / value metadata pair: two attributes http-equiv and name, each attribute should have a corresponding content corresponding to it.

Http-equiv in the meta tag

Http-equiv, as its name implies, is equivalent to the header function of http. It can send back some useful information to the browser to help display the content of the web page correctly and accurately.

1. Content-Type (set the character set used by the page)

2. Content-Language (setting of display language)

3. Refresh (refresh)

Automatically refresh and point to the new page. Among them, 2 refers to the automatic refresh to the URL URL after staying for 2 seconds.

The following code means that the page is automatically refreshed every 2 seconds

4. Set-Cookie (cookie setting)

Note: if the web page expires, then the saved cookie will be deleted. You must use the time format of GMT.

5. Window-target (setting of display window)

Description: forces the page to be displayed as a separate page in the current window. It is used to prevent others from calling their own pages in the frame.

6. Expires (term)

Can be used to set the expiration time of a web page. Once the web page expires, it must be retransmitted to the server. You must use the time format of GMT, which is set to 0 to identify never expire.

7. Pragma (cache mode)

Used to set to prevent browsers from accessing page content from the local cache. Once you leave the page, you can't call it out of the Cache. In this setting, visitors will not be able to browse offline.

8. Cache-control caching mechanism

Cache-Control specifies the caching mechanism that requests and responses follow. The cache instructions at the time of the request include no-cache, no-store, max-age, max-stale, min-fresh, only-if-cached, and the instructions in the response message include public, private, no-cache, no-store, no-transform, must-revalidate, proxy-revalidate, max-age. The instructions in each message are as follows:

Public indicates that the response can be cached by any cache

Private indicates that all or part of a response message for a single user cannot be processed by a shared cache. This allows the server to describe only part of the response message of the user, which is not valid for requests from other users

No-cache indicates that request or response messages cannot be cached

No-store is used to prevent important information from being inadvertently published. Sending in a request message causes both the request and response messages to be cached.

Max-age instructs the client to receive responses with a lifetime of no more than a specified time (in seconds)

Min-fresh indicates that the client can receive a response whose response time is less than the current time plus a specified time.

Max-stale instructs the client to receive response messages that exceed the timeout period. If the value of the max-stale message is specified, the client can receive a response message that exceeds the specified value of the timeout period

The default is private. Its function can be divided into the following situations according to different ways of re-browsing:

(1) Open a new window

If you specify the values of cache-control as private, no-cache, must-revalidate, the server will be revisited when a new window is opened for access. If the max-age value is specified, the server will not be reaccessed within this value, for example:

Cache-control: max-age=5

Indicates that when you visit this page, you will not visit the server again within 5 seconds.

(2) enter in the address bar

If the value is private or must-revalidate (which is different from what is said on the Internet), the server will only be accessed on the first visit and will not be accessed later. If the value is no-cache, it will be accessed every time. If the value is max-age, access is not repeated until it expires.

(3) Press the back button

If the values are private, must-revalidate, max-age, the access will not be revisited, while if it is no-cache, the access will be repeated every time.

(4) Press the refresh button

No matter what the value is, the visit will be repeated.

When you specify a Cache-control value of "no-cache", accessing this page does not leave a page backup in the Internet temporary article folder.

In addition, caching is also affected by specifying a "Expires" value. For example, if you specify the expires value as a time that has already passed, if you repeatedly press enter in the address bar when accessing this network, the visit will be repeated each time:

9 、 Page_Enter 、 Page_Exit

Set the special effects when entering the page

Set the special effects when you leave the page

The value of Duration is the time of dynamic transition of the web page, in seconds.

Transition is a transition mode, with values from 0 to 23, corresponding to 24 transition modes. As follows:

0 box contraction 1 box radiation

2 circular contraction 3 circular radiation

4 from bottom to top 5 from top to bottom

6 from left to right 7 from right to left

8 vertical blinds 9 horizontal blinds

10 horizontal lattice blinds 11 vertical lattice blinds

12 dissolve at will 13 unfold from the left and right ends to the middle

14 from the middle to the left and right ends 15 from the upper and lower ends to the middle

16 expand from the middle to the upper and lower ends 17 from the upper right corner to the lower left corner

18 expand from the lower right corner to the upper left corner 19 from the upper left corner to the lower right corner

20 expand 21 horizontally from the lower left corner to the upper right corner

22 Vertical line expansion 23 randomly produces a transition mode

10. Prohibit mobile transcoding of no-siteapp and no-transform

No-siteapp is Baidu's standard, no-transform is a common standard, but domestic Baidu's support for no-transform is relatively poor, so it is best to write two lines for this function and use both of them.

11. Give priority to the latest version of IE or chrome

Name in the meta tag

Keywords: keyword for the current page

Description: description of the current page

Author: the author of the current page

Generator: what software is used to make the current page?

Revised: the last modification time of the web document

Copyright: website copyright information

Robots: tell the search robot which pages need to be indexed and which don't

All | none | index | noindex | follow | nofollow. Default all

All: the file will be retrieved and the links on the page can be queried

None: files will not be retrieved and links on the page cannot be queried

Index: the file will be retrieved

Follow: links on the page can be queried

Noindex: files will not be retrieved, but links on the page can be queried

Nofollow: files will not be retrieved and links on the page can be queried.

Viewpor: page scaling settin

Width: sets the width to a positive integer, or the string "width-device"

User-scalable: whether to allow users to zoom. The value is "no" or "yes". No means not allowed, yes means allowed.

Initial-scale: sets the initial scaling value of the page, which is a number and can be decimal

Minimum-scale: the minimum scaling value allowed for a user, which is a number and can be decimal

Maximum-scale: the maximum scaling value allowed for users, which is a number and can be decimal

Height: set height. This property is not important to us and is rarely used.

Miniual-ui: single attribute. Safari of ios is a new property for meta. When loading a web page, it hides the address bar at the top and the navigation bar at the bottom.

These attributes can be used at the same time, alone or mixed, separated by commas when multiple attributes are used at the same time.

Renderer: specifies how the dual-core browser renders the page by default

Webkit: use a webkit core, which is generally a fast core. Ie-comp: IE is compatible with the kernel. Ie-comp: IE standard kernel

This is the end of "how to define a metadata in html5". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report