Modern browsers make it easy to customize components like icons, address-bar colors, and even add objects such as custom tiles. These simple touches improve your appeal and encourage users to return.
Provide great icons and tiles
When a user visits your page, the browser tries to extract an icon from the HTML. The icon may appear in many places: the browser tab, the recent-apps switcher, new (or recently visited) tab pages, and more.
Providing a high-quality image makes your site more recognizable and easier for users to spot.
To fully support all browsers, you need to add a few tags to each page's <head> element:
<link rel="icon" sizes="192x192" href="icon.png">
<link rel="apple-touch-icon" href="ios-icon.png">
<meta name="msapplication-square310x310logo" content="icon_largetile.png">
Chrome and Opera
Chrome and Opera both use icon.png, scaled to the size the device needs. To prevent automatic scaling you can also provide extra sizes with the sizes attribute. Note: icon sizes should be based on 48px, e.g. 48px, 96px, 144px and 192px.
Safari
Safari also uses the <link> tag with a rel attribute: apple-touch-icon.
You can specify explicit sizes — giving each icon its own link tag prevents the OS from resizing them:
<link rel="apple-touch-icon" href="touch-icon-iphone.png">
<link rel="apple-touch-icon" sizes="76x76" href="touch-icon-ipad.png">
<link rel="apple-touch-icon" sizes="120x120" href="touch-icon-iphone-retina.png">
<link rel="apple-touch-icon" sizes="152x152" href="touch-icon-ipad-retina.png">
Internet Explorer and Windows Phone
Windows 8's new home-screen experience supports 4 different pinned-site layouts, so 4 icons are needed. If you don't want to support a given size, you can omit the related meta tags.
<meta name="msapplication-square70x70logo" content="icon_smalltile.png">
<meta name="msapplication-square150x150logo" content="icon_mediumtile.png">
<meta name="msapplication-wide310x150logo" content="icon_widetile.png">
Tiles in Internet Explorer
Microsoft's "pinned sites" and their rotating "live tiles" go far beyond other implementations and are outside the scope of this guide. Learn more in MSDN's How to create live tiles.aspx).
Define colors for browser elements
Using different meta elements, you can customize the browser and even parts of the platform. Keep in mind some elements only work on specific platforms or browsers, but they can greatly enhance the experience.
Chrome, Firefox OS, Safari, Internet Explorer and Opera Coast let you define colors for browser elements — and even for the platform — with meta tags.
Meta theme color for Chrome and Opera
To set the theme color for Chrome on Android, use the theme-color meta tag:
<meta name="theme-color" content="#4285f4">
Safari-specific styling
Safari lets you set the status-bar style and specify a startup image.
Specifying a startup image
By default, Safari shows a blank screen during load and, after several loads, a screenshot of the app's previous state. To avoid this, add a link tag with rel=apple-touch-startup-image so Safari shows a dedicated startup image. For example:
<link rel="apple-touch-startup-image" href="icon.png">
The image must be the exact size of the target device's screen or it won't be used. See the Safari Web Content Guide for details.
Although Apple's documentation is thin on this topic, the developer community has figured out a way to target all devices: use advanced media queries to select the right device, then specify the correct image. One working solution is provided by tfausak's gist.
Changing the status bar's appearance
You can change the default status bar's appearance to black or black-translucent. With black-translucent, the status bar floats on top of the full-screen content instead of pushing the content down. This gives the layout more height, but slightly covers the top. Here is the required code:
<meta name="apple-mobile-web-app-status-bar-style" content="black">
Source: https://developers.google.com/web/fundamentals/design-and-ux/browser-customization?hl=zh-cn
Quantum Responses (0)