Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Webview converting numerics to phone numbers

Let's say I programmatically set the innerHTML of a div called test to 96840664702 and then write javascript…

alert(document.getElementById('test').innerHTML

In Mobile Safari on the iPhone, Firefox, etc., the alert will read "96840664702". If I point webview (using the iPhone emulator or loading a test app onto the iPhone) to the same page, the alert will read:

    <a href ="tel:96840664702" x-apple-data=detectors="true">96840664702</a>

How can I globally disable the data-detectors? I tried a couple meta-tags…

<meta name=”format-detection” content=”telephone=no”>
<meta name="x-" http-equiv="x-rim-auto-match" forua="true" content="none">

… but they didn't work. I couldn't find a reference for a meta tag that specifically mentioned Apple's detectors.

Since it works on the iPhone when I use Safari (vs. as a Titanium app), I assume there's a webview property I don't know about, but there's nothing listed in the API documentation under Titanium.UI.Webview.

— asked April 17th 2010 by Chocolate Asparagus
  • converting
  • data-detectors
  • links
  • numbers
  • tel
  • to
  • webview iphone help
0 Comments

6 Answers

  • Turns out in web views do this to turn off auto detection, at least on the iPhone side: mywebview.autoDetect = [];

    — answered September 29th 2010 by Matt Collinge
    permalink
    1 Comment
    • It really works for me!! Thank you for the info!

      — commented May 23rd 2012 by Dooee Park
  • Have you found a solution to the problem? I tried the meta-tags as well but it keeps doing it as well. A work around is to change the html and make it an &lt;a href=javascript:void(0)&gt;96840664702&lt;&#x2F;a&gt; and to change the css so that a are rendered the same that way the user won't notice the difference. However, if you have found a solution share please.

    — answered July 27th 2010 by Abraham Vivas
    permalink
    0 Comments
  • I'm also interested on an solution of this problem. Any new ideas?

    — answered August 27th 2010 by Mario Müller
    permalink
    0 Comments
  • I've just hit this as well.. raising with Pro Support….

    — answered September 20th 2010 by Matt Collinge
    permalink
    1 Comment
    • According to Pro support it's an iOS problem, nothing to do with Titanium.

      — commented September 23rd 2010 by Matt Collinge
  • I've masked what webkit considers as phone numbers with a bit of CSS (<style type="text/css">a:link {text-decoration: none; color:white;}</style>) in my WebView and I've disabled touch on it (touchEnabled:false)

    — answered April 21st 2011 by Sébastien BLONDY
    permalink
    0 Comments
  • Sorry double post

    — answered April 21st 2011 by Sébastien BLONDY
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.