views:

411

answers:

3

Is there a method for getting the iPhone users phone number using HTML5/jQuery?

All I see is how to do this with the SDK.

EDIT:

So far the only thing I've found is on the initial install ask the user for their number and store it.

A: 

You could just ask the user:

var phone_number = prompt("Please enter your phone number:");
Jeena
I could but this would not be the best user experience, would like to capture this behind the scenes if possible
Phill Pafford
This is your only real option at this time. Don't you think it may be a HUGE privacy issue if any site I browse to on my phone could get my phone number without me giving it to them?
jamone
Even if you technically *could* capture the phone number behind the scenes I would still use @Jeena's approach. What you're trying to do is completely ridiculous for all the reasons previously stated and I'm entirely disgusted that anyone would think to do such a thing.Actually, I think it would be pretty awesome if there were such a function, but if the iPhone had a built-in method to prompt the user with a security warning, kinda' like the Microsoft Windows Vista/7 UAC prompt. That way, there might be some useful applications for it without the security/privacy issues.
sfjedi
+4  A: 

i am pretty sure that this is not possible. Imagine the security leak it would be if any site could just retrieve the phone number of each visitor.

meo
That's what I was thinking :(
Phill Pafford
there is a similar question here: http://stackoverflow.com/questions/2386011/read-gsm-number-from-iphone-through-javascript
meo
I wonder about questions like this. What possible legitimate reason could you have for collecting a phone number? I would think Apple would reject the app... at least I hope they would.
Michael
An HTML5 application is a Web Application accessible from a server and won't be accessible from AppStore, so Apple has nothing to say.
Cbe317
+3  A: 

There is a Draft from W3C on Device API. This API will provide access (submitted to user permission) to Tasks, Contacts, Calendar, Camera, Microphone, Messaging Service, Communication Log, System Information (device information, battery level, network status, ...),... But it is not yet implmented in any browser.

Because of a big expectation, these APIs will probably be implemented very quickly in WebKit (base of iPhone and Android browsers). Mozilla is working on a draft implementation of Contact API with the Contact AddOn

Cbe317
Ha! Ask and you shall receive! I just posted a how-cool-would-it-be about this on @Jeena's post.
sfjedi