使用 Javascript 触发电话

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16781772/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 05:58:24  来源:igfitidea点击:

Trigger phone call with Javascript

javascripttel

提问by Jody Heavener

I would like to trigger a tel:12345HREF using only Javascript, not with an anchor. I simply want to grab the value of an input field and use JS to prompt the user to call the number typed in. My trigger will be a button located next to the field.

我想tel:12345仅使用 Javascript 而不是锚点来触发HREF。我只想获取输入字段的值并使用 JS 提示用户拨打输入的号码。我的触发器将是位于该字段旁边的按钮。

Suggestions?

建议?

回答by Tom

Use:

利用:

window.open('tel:12345');