问题
Problem
I want to call anonymously using an HTML tel: link with the prefix #31#. This works on iPhone, but on Android it opens up an empty dial screen.
Using tel: links without the prefix work fine on both android and iPhone.
When clicked, the link does open the phone app, but the dial screen is empty. Without the prefix the dialscreen has the phonenumber filled in, ready to be called.
What I've tried
I tried to use encodeURIComponent('#31#')
to escape the pound signs to no avail
<a href="tel:#31#0123456798">Anonymous tel:#31#</a> //opens empty dial screen
<a href="tel:0123456789">Regular tel:</a> //does work, but it's not anonymous
My research
Similar topics on stackoverflow only talk about native android code using Android Intent and ACTION_CALL which is not available in JavaScript. This is not of any use for me, I need a basic HTML (or Javascript) solution.
Question
How do I make an anonymous phone call on Android using a tel:
link in HTML?
Code to demonstrate the problem
https://codepen.io/skrln/pen/WaPEwO
回答1:
You have to replace the #
with %23
so you get %2331%23
instead of #31#
.
For example:
tel:%2331%23XXXXXXXXXX
来源:https://stackoverflow.com/questions/51019518/tel-link-not-working-on-android-when-anonymous-call-code-31-is-used