Set default iOS web clip icon title?

2020-05-23 03:17发布

问题:

Is it possible to set a default title or override the generated title for when a user is in Safari on their iOS device and clicks "Add to Home Screen"?

I imagine this title is being pulled from the HTML's <title>Example.com</title> tag. However, I would like to target just iOS devices with a specific title.

A matter of fact, the title that iOS pulls in is not even the full title of my site; however, iOS clearly accepts more character input when I do it manually.

回答1:

In iOS 6 it is now possible to manually set a default web clip title using the following undocumented meta tag:

<meta name="apple-mobile-web-app-title" content="[your title]" />

Thanks to Max Firtman for covering this in his article on the iPhone 5 and iOS 6 for HTML5 developers.



回答2:

When you "Add to Home Screen", iOS only looks at the <title></title> on your page. It truncates the title so that it's short enough to show the whole thing below the icon without having "..." in the middle of it. That's not something you can change, but you can adapt to it by changing your <title></title> if the user opens the page in iOS using server-side code or JavaScript.

More information about web apps are in the Apple docs are here: https://developer.apple.com/library/safari/#codinghowtos/Mobile/UserExperience/_index.html