“apple-mobile-web-app-title” on Android

流过昼夜 提交于 2019-12-03 11:37:39

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/

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.

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";
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!