Html 自动拨打电话号码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8500445/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
automatically dial a phone number
提问by Newbee
I have a web page where i have a button. I need to automatically dial a phone number on the click of the button. It needs to be done in HTML.
我有一个网页,我有一个按钮。我需要点击按钮自动拨打电话号码。它需要在 HTML 中完成。
I need to do it on the onclick event of the button
我需要在按钮的 onclick 事件上做
回答by
On mobile devices, there are protocol handlers to launch the phone. Depending on the security, some will dial it, or others will bring on the phone application with the number already there.
在移动设备上,有用于启动电话的协议处理程序。根据安全性,有些人会拨打它,或者其他人会使用已经存在的号码打开电话应用程序。
<a href="tel:+15555555555">Call me at +1 (555) 555-5555</a>
回答by JoshW
I've used this in the past for mobile apps:
我过去曾将其用于移动应用程序:
<button id="call">Call</button>
<script>
$("#call").on('click', function() {
var link = "tel:18003334444";
window.location.href = link;
});
</script>
This, of course, uses jQuery.
这当然使用 jQuery。
回答by SuperTron
Well, I don't think this is possible in HTML... Have you done any research on Java or PHP? a quick google reveals a grand central API, and Java Phone, But I don't know how much help they will be. Also, for future reference, it helps if you tell us what you want to do with this number, will you be connecting it to another phone number? To your computer? Etc. Regardless, this is going to be a fairly complex project, and would be so even if you were comfortable with a real programming language. Your best approach would be to figure out your options and then come back to Stack overflow if you need help on choosing one. Best of luck!
嗯,我不认为这在 HTML 中是可能的...你对 Java 或 PHP 做过任何研究吗?一个快速的谷歌揭示了一个宏伟的中央 API和Java Phone,但我不知道它们会有多大帮助。此外,为了将来参考,如果您告诉我们您想用这个号码做什么,会有所帮助,您会将它连接到另一个电话号码吗?到你的电脑?等等。无论如何,这将是一个相当复杂的项目,即使您熟悉真正的编程语言也会如此。你最好的方法是找出你的选择,然后如果你需要帮助来选择一个,然后回到堆栈溢出。祝你好运!
回答by tinyd
I have to declare a commercial interest. I work for Cisco and we've developed a JavaScript SDK and browser plugin that enable you to do this, but only in a Cisco deployment. If you're interested, here's the link:-
我必须申报商业利益。我为 Cisco 工作,我们开发了一个 JavaScript SDK 和浏览器插件,使您能够执行此操作,但仅限于 Cisco 部署。如果你有兴趣,这里是链接:-