19

I build a website for phones like android and iphone,when users are visiting my site,is it possible for me to invoke some system build in activities like Dialer or SMS)?

I want to implement this cause I hope when user click the link with phone number,I can start to call directly.

************Edit*******************

I think it is possible cause in android when I click a url like this:

<html>
<body>
<a href="market://search?q=pname:com.joelapenna.foursquared">asdfasdfsdf</a>
</body>
</html>

it will open the market app and lead me to the app I search.

so I think if we format the url in some way ,maybe it can also open the Dialer app in Android.

ps.I know it must be another case when it comes to Iphone,but currently,it is fine enough it works with Android,any one ,any idea ?

Thanks ^_^.

DiveInto
  • 2,158
  • 3
  • 27
  • 50

2 Answers2

50

You need the tel protocol. This will launch the native phone dialer. Use it as

<a href="tel:555-123-4567">

More on Wikipedia and the RFCs: 2806 and 3966

Community
  • 1
  • 1
Matt Lacey
  • 65,560
  • 11
  • 91
  • 143
-1

Wouldnt this represent a MAJOR security hole?

i.e. craft a URL that forces the phone to dial a premium rate number that I own....

pauljwilliams
  • 19,079
  • 3
  • 51
  • 79
  • 1
    I also doubt about that,but in this case,it will just open the telephone app and won't make the call until the user decide to,so I think it is OK. – DiveInto Sep 08 '10 at 04:02
  • Yes, @DiveInto is correct. I am not aware of any platform which actually starts the call this way. Rather it opens the app with the numer prepopulated so it's a single click to start the call. Most browsers will also prevent urls to protocols such as this from being launched programatically. – Matt Lacey Sep 08 '10 at 08:12
  • it only opens a dialer with number, you have to press the call button for the dialer to dial, hence its not a threat. – Clain Dsilva Feb 19 '19 at 09:19