Mobile app version of vmapp.org
Login or Join
Lee4591628

: Keep Iphone browser from turning numbers into links I'm writing a very simple page that is supposed to be viewed on mobile devices. While viewing it in the iphone simulator I noticed that the

@Lee4591628

Posted in: #Browsers #Html #Iphone

I'm writing a very simple page that is supposed to be viewed on mobile devices. While viewing it in the iphone simulator I noticed that the iphone browser automatically turns any number string into a link, supposedly for dialing it directly.

Problem is - there are a ton of numbers on my page that LOOK like phone numbers but actually aren't. Is there a way to tell the iphone browser to leave these numbers alone?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Lee4591628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Sims2060225

Very poor implementation on Apple's part (I hear this also happens on the iPad, where it makes no sense whatsoever), but there is a fix:

<meta name="format-detection" content="telephone=no" />


Source: www.darowski.com/tracesofinspiration/2009/03/31/stop-iphone-from-incorrectly-auto-linking-phone-numbers/
One of the comments on that page also suggests the use of the controversial soft hyphen (&shy;) to prevent auto-linking of a specific number (so the browser can still auto-link other numbers on the page).



Additional Info

If you want to link certain numbers but not others, I would personally use the format-detection meta tag to disable autolinking numbers, and then explicitly link the ones that are phone numbers:

<div itemscope itemtype="http://schema.org/LocalBusiness">
<h1 itemprop="name">Foo Co.</h1>
<dl>
<dt>Phone</dt>
<dd><span itemprop="telephone"><a
href="<?php echo ($isMobile? 'tel' : 'callto') ?>:+15555555555">
555-555-5555</a>
</span></dd>
<dt>Client ID</dt>
<dd>1234567890</dd>
</div>


The PHP snippet is there to swap out the tel: scheme for callto: if it's not a mobile browser. This way Skype and other desktop VoIP programs can be triggered when the link is clicked.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme