Prevent Phone Number recognition on JqueryMobile

半城伤御伤魂 提交于 2019-12-22 18:23:35

问题


I have this problem using Jquery Mobile. The issue was I have a date value of "12/6/1999" that is displayed on a label. Now JQuery Mobile converted it to a link because it is recognize as a phone number. I'm not very sure if it's jquery that does that or the iPhone.

So, my first approach was I'm looking for a way to prevent jquery mobile to recognize phone numbers. Is there a way to do it?

If it's iPhone that does it, is there a way that I can disable it?

Your help is greatly appreciated.


回答1:


You could try

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

This will tell safari to not detect phone numbers.

More info on http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/PhoneLinks.html




回答2:


You can do this in two seperate ways.

HTML disabling

<p datadetectors="off">Header text with number 9123 3456</p> 
<p>Body text with number 9872 4567</p>

Or globally on your uiwebview

webview.dataDetectorTypes=0;



回答3:


what is the input element type set to? make sure it's set to date.

Example:

<label for="date">Date Input:</label>
<input type="date" name="date" id="date" value=""  />

Docs:

  • http://jquerymobile.com/demos/1.0a4.1/experiments/ui-datepicker/
  • http://dev.jtsage.com/jQM-DateBox/



回答4:


What I did was something like this. Made the date as a href with no link.

<a href="#" class="unlink">2012-08-23/a>

Then applied CSS to modify the link to looks like texts.

.unlink {
    text-decoration: none;
    color: #333;
    cursor: text;
}


来源:https://stackoverflow.com/questions/6239057/prevent-phone-number-recognition-on-jquerymobile

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!