Mobile ignores method of recognizing numbers in pages as phone numbers

HTML5  iOS _

 

1. The standard phone number format is as follows: <a href="tel:1-408-555-5555">1-408-555-5555</a>, the phone function will be automatically opened after clicking;

2. But sometimes numbers that are not phone numbers are automatically parsed as phone numbers by the browser, and the color and style of the numbers are changed;

3. If you ignore the numbers in the page and identify them as phone numbers, just turn off this default behavior, just one line of code:

 

[javascript]  view plain copy  
 
  1. <meta name = "format-detection" content = "telephone=no">  

4. This closure will not affect the identification of the real phone number;

 

illustrate:

Disable the phone function for numbers when the device is browsing the web (different devices have different interpretations, iTouch clicks a number to save a contact, iPhone makes a call), and ignores the number in the page to be recognized as a phone number. 
If you need to enable the phone function, you can set telephone=yes. If there are links to Google Maps, iTunes and YouTube on the page, the corresponding program components will be opened on the ios device.

Note: The above methods are all for iOS devices, how about Android devices?

 

The format-detection attribute and meaning in the Meta tag

The translation of format-detection into Chinese means "format detection". As the name suggests, it is used to detect some formats in html. The format-detection attribute of meta mainly has the following settings:
[javascript]  view plain copy  
 
  1. <meta name="format-detection" content="telephone=no">  
  2. <meta name="format-detection" content="email=no">  
  3. <meta name="format-detection" content="adress=no">  
  4. <meta name="format-detection" content="telephone=no,email=no,adress=no">  

The following is a detailed description of the role of each setting:
Telephone

You clearly wrote a string of numbers without a link style, and the iPhone will automatically add a link style to your text, and click the number to automatically dial! How to remove this dial-up link? At this time, our meta should show its magic again. The code is as follows:

telephone=no prohibits converting numbers into dial-up links!
telephone=yes will turn on the conversion of numbers into dial-up links. To turn on the conversion function, this meta need not be written. It is turned on by default!

2. Email

Tell the device not to recognize the mailbox and not send it automatically after clicking

email=no is forbidden as an email address!
Email=yes is turned on and the text is defaulted to the email address, so this meta does not need to be written, it is turned on by default!

Three, adress

adress=no forbids jumping to the map!
adress=yes enables the function of clicking on the address to jump directly to the map, which is enabled by default!

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324581072&siteId=291194637
Recommended