{"id":270,"date":"2009-07-26T15:56:39","date_gmt":"2009-07-26T13:56:39","guid":{"rendered":"http:\/\/hjacob.com\/blog\/?p=270"},"modified":"2009-10-21T13:48:11","modified_gmt":"2009-10-21T11:48:11","slug":"making-a-phone-number-clickable-for-iphone-users","status":"publish","type":"post","link":"https:\/\/hjacob.com\/blog\/making-a-phone-number-clickable-for-iphone-users\/","title":{"rendered":"Making a Phone Number clickable for iPhone Users"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/hjacob.com\/blog\/wp-content\/uploads\/2009\/07\/IMG_0450-200x300.PNG\" alt=\"iPhone: A phone Number on a website is clicked\" title=\"iPhone: A phone Number on a website is clicked\" width=\"200\" height=\"300\" class=\"floatright size-medium wp-image-271\" srcset=\"https:\/\/hjacob.com\/blog\/wp-content\/uploads\/2009\/07\/IMG_0450-200x300.PNG 200w, https:\/\/hjacob.com\/blog\/wp-content\/uploads\/2009\/07\/IMG_0450.PNG 320w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>Are you wondering how to markup a phone number on a website so the iPhone (and maybe other mobiles) can parse the number and make it &#8222;clickable&#8220; for the user? The good news is, it is pretty simple as the iPhone&#8217;s browser does a good job but on the other hand you have to mind some things otherwise the device can&#8217;t detect the number.<\/p>\n<p><!--more Read on --><\/p>\n<h2>Why should i mind making a number clickable?<\/h2>\n<p>The answer is easy: Usability! Especially if you are working on a online shop or selling page you want to provide the users \/ customers the best user expierence possible. One important rule in good user expierence (= usability) is to answer questions which might raise by viewing your website and the best way to do this by direct contact.<\/p>\n<h2>Auto Detection of Phone Numbers<\/h2>\n<p>As mentioned above, the iPhone does a good job in automatically parsing phone numbers. Here are some formats of a german cell phone number, which the iPhone recognizes without any further markup &#8211; please note the different seperators which divide the (country-) prefix from the number.<\/p>\n<h3>Number Formats which get auto-detected<\/h3>\n<div id=\"attachment_272\" style=\"width: 330px\" class=\"wp-caption floatright\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-272\" src=\"http:\/\/hjacob.com\/blog\/wp-content\/uploads\/2009\/07\/IMG_0453.PNG\" alt=\"The Screenshot shows the iPhone display of the tested number formats.\" title=\"iPhone Screenshot which shows the correctly auto-parsed numbers\" width=\"320\" height=\"480\" class=\"size-full wp-image-272\" srcset=\"https:\/\/hjacob.com\/blog\/wp-content\/uploads\/2009\/07\/IMG_0453.PNG 320w, https:\/\/hjacob.com\/blog\/wp-content\/uploads\/2009\/07\/IMG_0453-200x300.PNG 200w\" sizes=\"(max-width: 320px) 100vw, 320px\" \/><p id=\"caption-attachment-272\" class=\"wp-caption-text\">The Screenshot shows the iPhone display of the tested number formats.<\/p><\/div>\n<ul>\n<li>0176-40206387<\/li>\n<li>0176-402063-87<\/li>\n<li>0176.40206387<\/li>\n<li>0176.402063 87<\/li>\n<li>0176.402063-87<\/li>\n<li>0176-402063.87<\/li>\n<li>0176 402063.87<\/li>\n<li>0176\/40206387<\/li>\n<li>0176\/402063-87<\/li>\n<li>0176 402063 87<\/li>\n<li>0049176\/40206387<\/li>\n<li>0049-176\/40206387<\/li>\n<li>+49 176 40206387<\/li>\n<li>+49-176\/40206387<\/li>\n<li>+4917640206387<\/li>\n<\/ul>\n<p>What do we learn from this? The iPhone recognizes 1-Char delimiters  like &#8222;.&#8220;, &#8222;\/&#8220;, &#8222;-&#8220; or &#8222;Space&#8220; without a flaw. It can also handle Country prefixes (+49 or 0049) if at least the number contains a delimiter (&#8222;0049176<b>\/<\/b>40206387&#8243;) or the Country prefix is indicated by a leading &#8222;+&#8220; (&#8222;+4917640206387&#8220;). The <b>common format of two leading zeros isn&#8217;t correctly parsed<\/b>, when the number doesn&#8217;t contain a delimiter! (See below)<\/p>\n<h3>Number formats which fail to auto-detect<\/h3>\n<ul>\n<li><strong>017640206387<\/strong><\/li>\n<li><strong>004917640206387<\/strong><\/li>\n<li>0176 &#8211; 40206387<\/li>\n<li>0176 \/ 40206387<\/li>\n<li>+49 (0)176 \/ 40206387<\/li>\n<li>0049 (0)176 40206387<\/li>\n<li>0049 (0)176\/40206387<\/li>\n<\/ul>\n<p>Did you note? The <b>iPhone fails to detect a number which is written without any seperator<\/b> (of prefix and number), in this case &#8222;017640206387&#8220;. So watch out to put a 1-Char delimiter in your phone numbers. The emphasis is on 1-Char, as more chars will break the auto-detection! You can see this with the for example in this number format:  &#8222;0176 \/ 40206387&#8220;, which is pretty common here in Germany. Its a 3-Char delimiter: A <em>Slash<\/em> with a leading <em>Space<\/em> and a following <em>Space<\/em>. So you better <strong>keep in mind to just use one Character as a seperator<\/strong>.<\/p>\n<h3>Number formats which are wrongly parsed<\/h3>\n<ul>\n<li>+49 (0)17640206387<\/li>\n<li>+49 (0)176-40206387<\/li>\n<li>+49 (0)176-402063-87<\/li>\n<li>+49 (0)176\/40206387<\/li>\n<li>+49 (0)176.40206387<\/li>\n<li>+49.(0)176-40206387<\/li>\n<\/ul>\n<p>Here we see a bunch of number formats which are widely used in Germany and which show the Country Prefix (&#8222;+49&#8220;) followed by the carriers prefix (&#8222;0176&#8220;). If someone outside Germany dials this number, the leading zero of the carriers prefix gets droped, so the caller dials (&#8222;0049 176 40206387&#8220;), of course same applies to other country prefixes like the &#8222;+1&#8220; for the USA. But if someone within Germany dials this number, he doesn&#8217;t need to dial the country prefix but has to mind the leading zero &#8211; so he dials &#8222;0176 40206387&#8220;. <\/p>\n<p>So what&#8217;s going wrong here? <b>The iPhone parses the number, but does not drop the leading zero<\/b>. So if the user clicks a number of this format, the iPhone dials &#8222;+49 <b>0<\/b>176 40206387&#8243; which will end in an &#8222;<em>Unknown Number<\/em>&#8222;-Error Message.<\/p>\n<p>This bug is quite bad, as this <b>format is widely used in the business world<\/b>, as it indicates all possible prefixes and is also very readable to humans. But have no fear there is a way out!<\/p>\n<h2>Manual Markup to the rescue!<\/h2>\n<p>If you want to use a number format which isn&#8217;t supported by the iPhone or which is not correctly parsed you can fix this by a HTML link:<br \/>\n[sourcecode lang=&#8220;html&#8220;]<br \/>\n<a href=\"tel:+4917640206387\">+49 (0)176 &#8211; 402 063 87<\/a><br \/>\n[\/sourcecode]<br \/>\nMost important is the &#8222;<strong>tel:<\/strong>&#8220; in the HREF attribute. If you use this so called <em>telephone link<\/em> on your website, the phone number <b>gets clickable for iPhone Users<\/b> (and probably other mobile devices). With help of the telephone link you can also make number more readable to humans, like in my example where i&#8217;ve added a 3-Char delimiter and a couple of spaces. The only disadvantage of the telephone link is that it will display the phone number as link on ordinary desktop browsers, too. And those don&#8217;t know what to do with this kind of link and so they point to nowhere.<\/p>\n<p>By the way: <strong>You can also use the telephone link in your E-Mail Signature<\/strong> so if a iPhone user gets a mail from you, he can call back with a single click.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to make phone numbers link to a call on iPhones. HowTo-Guide on correct formating on Websites, including &#8218;Telephone Link&#8216; Syntax. <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[54,36,13,3],"tags":[134,132,133],"_links":{"self":[{"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/posts\/270"}],"collection":[{"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/comments?post=270"}],"version-history":[{"count":16,"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/posts\/270\/revisions"}],"predecessor-version":[{"id":458,"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/posts\/270\/revisions\/458"}],"wp:attachment":[{"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/media?parent=270"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/categories?post=270"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hjacob.com\/blog\/wp-json\/wp\/v2\/tags?post=270"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}