问题
is there an equivalent to iOS 6 meta tag apple-mobile-web-app-title
for android web-applications? Something that gives you the possibility to define a long title and a short title.
<title>Long name</title>
<meta name="apple-mobile-web-app-title" content="Short name">
回答1:
This is possible using the "application-name" meta tag. However it only appears to work with chrome. Firefox and the android browser don't use the title tag
<head> ... <meta name="application-name" content="Awesome App!"> ... </head>
From, Usage in web applications section
http://w3c-webmob.github.io/installable-webapps/
回答2:
Chrome has added support for JSON-based manifest file for your web app since M39. The field short_name
is equivalent to Safari's apple-mobile-web-app-title
in that it would be preferred where there is limited space to display the full name, e.g. app launcher.
W3C spec for short_name
field in web app manifest file:
The short_name member is a string that represents a short version of the name of the web application. It is intended to be used where there is insufficient space to display the full name of the web application.
回答3:
One way you can do this is by using javascript to detect the mobile browser and then change document.title to a shorter title:
if (navigator.userAgent.match(/(iPad|iPhone|iPod|Android|Silk)/gi))
document.title = "Short Title";
来源:https://stackoverflow.com/questions/15083788/apple-mobile-web-app-title-on-android