Posted: Tuesday 30th August 2011
Members of the Web Services Team have recently been uploading content for a new student mobile app. As it's the first mobile app we've worked on we've learnt a lot and much of it is applicable to the University website. An increasing number of visitors to our site will be visiting on mobile devices and many will have an expectation that they can phone a number directly from any web page. At present that isn't always possible...
iOS and Android will automatically pick up some plain-text patterns and treat them as phone numbers, in accordance with national and international phone number conventions:
0121 111 2222
+44 121 111 2222
Both of the above will work correctly and dial when clicked.
The standard University style includes the optional zero for national dialling codes:
+44 (0) 121 111 2222
This will be parsed as +44 0121 111 2222 which is an invalid number - it has too many digits - hence won't dial correctly.
However, it's possible to manually specify the underlying phone number using an HTML anchor. As an example, the University formatting could be used for display, whilst a valid international format is used for the number to dial:
<a href="tel:+44 121 111 2222">+44 (0) 121 111 2222</a>
notice that the HREF target has the optional zero removed. This will produce a valid, dialable number.