views:

3887

answers:

7

Safari on iPhone automatically creates links for strings of digits that appear to the telephone numbers. I am writing a web page containing an IP address, and Safari is turning that into a phone number link. Is it possible to disable this behavior for a whole page or an element on a page?

+2  A: 

You could try encoding them as HTML entities:

0 = 0
9 = 9
Diodeus
+6  A: 

Add this, I think it is what you're looking for:

<meta name = "format-detection" content = "telephone=no">
Chuck
+18  A: 

This seems to be the right thing to do, according to the Safari Web Content Guide for iPhone:

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

If you disable this but still want telephone links, you can still use the "tel" URI scheme.

lewinski
A: 

Gracias funciona perfecto!!

Claudio
Claudio, don't use the Answer box to post a comment.
benzado
A: 

works on Iphone, but not on Ipod, at least on 3.0 => I must use htmlentities

liviu
A: 

If you add your web app to the home screen it stops working. Looks like only works when the app is accessed from Safari. Any ideas?

codedj
Don't use the answer box to post a question. Post a new question, link to this one if you want to refer to it.
benzado
+3  A: 

Think I've found a solution: put the number inside a <label> element. Haven't tried any other tags, but <div> left it active on the home screen, even with the telephone=no attribute.

It seems obvious from earlier comments that the meta tag did work, but for some reason has broken under the later versions of iOS, at least under some conditions. I am running 4.0.1.

BobFromBris
Hi Bob. If you want to put in HTML code examples, you have to wrap the code in backticks, `<like this>`. (Stack Overflow uses a formatting language called Markdown.) I’ll edit your answer accordingly.
Paul D. Waite
That didn't ultimately work - when I reloaded the App, the link hiliting was back. I have resorted to adding a`#` character to the front of the phone number: according to the Apple doc "Apple URL Scheme Reference":"Specifically, if a URL contains the * or # characters, the Phone application does not attempt to dial the corresponding phone number."
BobFromBris