The magic of html5 meta tags on mobile terminals and html5meta tags
When creating a mobile website, in addition to simple pages, convenient operations, and other places that visitors can see, Meta tag settings are used to reasonably set Meta tags to optimize the search engine of the mobile website, rendering and display of mobile browsers are of great help. I am not familiar with the meta tag in the web layout of the desktop platform. It will always be inside the head element. Do you have special feelings for SEO friends about meta, today we will talk about the meta tag of the mobile platform. What are the magical effects of the meta tag on the mobile platform?
1. Meta viewport
Speaking of the meta tag of the mobile platform, you have to talk about the viewport. What is the viewport?
Viewport is the visible area. For a desktop browser, viewport is the area used to view webpages after all the toolbar, Status Bar, and scroll bar are removed.
. For traditional WEB pages, the 980 width display on the iphone is normal and full screen, but it may be a problem for webapps, on the iphone, our webapp is usually 320 in width under the vertical screen. What is the effect of our 320 page on the iphone? Some people may think that the iPhone is not 320 in width. It should be full screen. What is the truth? Let's take a look at the following display on the iPhone:
The Code is as follows:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Title> Meta Viewport </title>
<Style type = "text/css">
Div, body {
Padding: 0;
Margin: 0;
}
Body {
Padding-top: 100px;
Color: # fff;
}
Div {
Width: 320px;
Height: 100px;
Margin: 0 auto;
Background: #000;
Text-align: center;
Font: 30px/100px Arial;
}
</Style>
</Head>
<Body>
<Div>
AppUE
</Div>
</Body>
</Html>
Therefore, we must change the viewport so that we can set the following attribute values:
Width: the width of the viewport. The value ranges from 200 to 10,000. The default value is 980 pixels)
Height: the height of the viewport. The value ranges from 223 to 10,000)
Initial-scale: initial scaling ratio (range:> 0 to 10)
Minimum-scale: minimum scale that allows users to scale
Maximum-scale: maximum scale allowed by users
User-scalable: whether the user can manually Scale
You can set one or more of these attributes without having to set them at the same time. The iPhone automatically calculates other attribute values based on the attributes you set, rather than directly using the default values.
If you set initial-scale to 1, the width and height values are automatically 320*356 (not 320*480 because the address bar occupies space) at the portrait screen ), the screen size is 480*208. Similarly, if you only set the width, the initial-scale and height values are automatically calculated. For example, if you set width = 320, initial-scale is 1 when the screen is portrait, and 1.5 when the screen is landscape. So how can we let Safari know about these settings? In fact, it is very simple, just a meta, like:
The Code is as follows:
<Meta name = "viewport" content = "width = device-width; initial-scale = 1.0; maximum-scale = 1.0; user-scalable = 0;"/>
Now, we can layout our page in full screen mode, so we don't have to worry about the small page!
2. format-detection of Meta
The Code is as follows:
<Meta name = "format-detection" content = "telephone = no"/>
The link style is not added to a string of numbers you clearly write, and the iPhone will automatically add the link style to your text, and click this number to automatically dial! How can I remove this dial-up link? At this time, our meta should be superb again. The Code is as follows:
If telephone is set to no, the number cannot be converted to a dial-up link!
Telephone = yes enables converting numbers to dial-up links. To enable the conversion function, you do not need to write this meta. By default, this function is enabled!
3. Meta-apple-mobile-web-app-capable
<Meta name = "apple-mobile-web-app-capable" content = "yes"/>
This meta is used to delete the default Apple toolbar and menu bar. Content has two values: "yes" and "no". When we need to display the toolbar and menu bar, this line of meta does not need to be added. The default value is display.
4. Meta-apple-mobile-web-app-status-bar-style
The Code is as follows:
<Meta name = "apple-mobile-web-app-status-bar-style" content = "default"/>
<Meta name = "apple-mobile-web-app-status-bar-style" content = "black"/>
<Meta name = "apple-mobile-web-app-status-bar-style" content = "black-translucent"/>
Controls the display style of the status bar.
The Code is as follows:
Status-bar-style: black
Status-bar-style: black-translucent
Today, let's talk about the Meta tags that need to be added to mobile Website:
Viewport
Viewport is almost already recognized as a standard. It was initially created by Apple and used for Mobile Safari on the iPhone. Thanks to the iPhone sales, most other Mobile browsers accept it, such as Opera Mobile, iPhone, android, Iris, IE, BlackBerry, Obigo, Firefox
The most basic example is to make the site full screen width on mobile:
The Code is as follows:
<Meta name = "viewport" content = "width = device-width, initial-size = 1.0"/>
HandheldFriendly
This label and the MobileOptimized introduced below are the de facto labels in the feature machine era.
The HandheldFriendly tag was first viewed in AvantGo to mark the mobile content. later it became a general standard to mark the mobile site, but I don't know the support of this tag.
The Code is as follows:
<Meta name = "HandheldFriendly" content = "true"/>
MobileOptimized
This is a proprietary meta tag in Windows and eventually becomes another method for identifying mobile content. However, the disadvantage of this tag is that the specific width must be given, the support for this label is also unknown:
The Code is as follows:
<Meta name = "MobileOptimized" content = "320"/>