nate8684
nate8684

Reputation: 539

Using javascript/jquery to dial a number

Does anyone know how I can dial a number using javascript? I've tried the following:

window.location.href = 'tel:7178081998';

The button registers a click but doesn't do anything in the ios environment.

I'm running into an issue where my "tel" links do not work because of a script that I have (FastClick). I've tried everything I can think of which is why I am at where I am.

Thoughts?

Upvotes: 5

Views: 1545

Answers (2)

Akki619
Akki619

Reputation: 2432

<a href="tel:5558675309">555-867-5309</a> This should work.

If need put a pop up dialog to ask user " Are you sure you want to call" Just in case s/he clicked it unintentionally.

<a id="call" href="">555-867-5309</a>

Use call id to open a dialog, on click of ok, put data dynamically to href attribute.

Upvotes: 1

MMeah
MMeah

Reputation: 1042

Sounds like a sandbox issue. Why not break out of the restriction with an iframe? Dynamically add it to the DOM and have it dial the number.

Adding IFRAME to DOM by Javascript

Upvotes: 0

Related Questions