简体   繁体   English

如何使用移动浏览器上的按钮拨打USSD代码

[英]How to dial USSD CODE by using button on mobile browser

I am trying to dial a USSD Code using this code 我正在尝试使用此代码拨打USSD代码

<button onclick="document.location.href = 'tel:*556#'">Check balance</button>

but is not working on mobile 但不适用于手机

You should rely on anchor tags for that since you want to open another app via a hyperlink. 您应该依靠锚标记,因为您想通过超链接打开另一个应用程序。

Using the following should work for you 使用以下内容应该适合您

<a href="tel:*556%23">Check balance</a>

%23 is the the url encoded value of # . %23#的url编码值。 The rule of thumb is to encode the url of your link (number). 经验法则是对链接的网址(数字)进行编码。 You can use encodeURIComponent('your-number-here') to do that 您可以使用encodeURIComponent('your-number-here')做到这一点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Android App拨打USSD代码? - Android App to Dial USSD codes? 如何使用jQuery将移动浏览器URL共享给按钮单击上的whatsapp? - How to share mobile browser url to whatsapp on button click using jquery? 单击移动浏览器中的按钮后如何打开移动应用程序(使用javascript / react)[深度链接] - How to open mobile app after clicking a button in mobile browser (using javascript / react) [Deep Linking] 如何从拨号代码中推断出国家代码? - How to deduce Country Code from Dial code? 如何使用 ReactJs 将网络摄像头流式传输到移动浏览器? - How to stream webcam into mobile browser by using ReactJs? 如何使用浏览器查找移动WiFi设置 - How to find mobile WiFi settings using browser 如果客户端使用移动浏览器,如何在perl中检测? - How to detect in perl if the client is using a mobile browser? 如何使用 JS 检测用户是否按下了手机(浏览器)中的后退按钮 - How to detect if user pressed back button in their mobile (browser) with JS JavaScript中ussd代码的正则表达式 - Regular expression for ussd code in JavaScript 如何使用jQuery Mobile动态创建按钮? - How to create a button dynamically using jQuery Mobile?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM