Last Updated: February 25, 2016
·
850
· codesbyaxel

Shorter page-title for IOS-devices

If you are creating apple-touch-icons to the webpages you develop, this short JS-code can be handy. It shortens the page-title of your site, making it easier for people to add your site directly to their homescreen - without having to edit the title to a shorter one.

PS: IOS-devices only!

/*! Custom, short page-title for IOS-devices */
if( navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) || 
navigator.userAgent.match(/iPad/i)
) {
document.title = "Short title";
}