Dealing with tel: anchor

前端 未结 2 586
無奈伤痛
無奈伤痛 2021-01-06 01:59

I have an anchor to a telephone number. On phones is great. On desktops with Skype or Google Voice it\'s good. The problem is on desktops that just don\'t know how to deal w

2条回答
  •  温柔的废话
    2021-01-06 02:21

    To detect if the browser is launching from a mobile in JavaScript: http://detectmobilebrowser.com/

    Then you can detect a phone number in JavaScript using a regular expression, such as one of those: http://www.regxlib.com/DisplayPatterns.aspx?cattabindex=6&categoryId=7

    And finally rewrite the link: aLink.href="..."

    The web-browser is responsible for launching the associated application for a certain link and I guess skype is registering for the phone numbers in the desktop. You can't do anything from the web-page I'm afraid.

提交回复
热议问题