简体   繁体   English

电话链接后备

[英]Tel link fallback

I am currently working on a mobile version of a site which has a "Call" link at the top. 我目前正在开发一个网站的移动版本,其顶部有一个“呼叫”链接。 I'm using a tel: protocol link to deal with that right now, but the problem is what happens if the user is on a tablet or a phone with no SIM card etc. If possible, I'd like to try the tel: link and if that fails then pop up a DIV with a couple of phone numbers they can choose from. 我正在使用tel:协议链接来解决这个问题,但问题是如果用户在平板电脑或没有SIM卡的手机上会发生什么。如果可能的话,我想试试电话:链接,如果失败,然后弹出一个DIV与他们可以选择的几个电话号码。 Any ideas how it might be possible to detect if the tel: link worked/works, either at page load or when it is clicked? 任何想法如何可以检测tel:link是否在页面加载或单击时工作/工作?

You're probably better off changing the way you present the phone number to the user. 您可能最好更改向用户显示电话号码的方式。 How about putting the information next to the call button or with a drop down that shows it? 如何将信息放在呼叫按钮旁边或显示下拉信息按钮? Detecting whether or not it succeeded is not likely to be cross platform. 检测它是否成功不太可能是跨平台的。

Another suggestion would be to change "call" to the phone number itself. 另一个建议是将“呼叫”改为电话号码本身。 Tablet users are less likely to click on it anyway if they actually see the number. 如果平板电脑用户实际看到该号码,则他们不太可能点击它。 "Call" is likely to either piss them off by thinking the phone number is being concealed from them assuming they're on a smart phone or make them think "ah, I can click here and it'll show me the number." 假设他们在智能手机上或者让他们认为“啊,我可以点击这里,它会向我显示号码”,“呼叫”可能会因为认为电话号码被隐藏起来而惹恼他们。

This is the closest thing available to what you may want to fool with: https://developer.mozilla.org/en-US/docs/Web/API/window.navigator.connection 这是你可能想要愚弄的最接近的东西: https//developer.mozilla.org/en-US/docs/Web/API/window.navigator.connection

Modernizer has an option to check this value for low/high bandwidth connections (look in the non-core options). Modernizer可以选择检查低/高带宽连接的此值(查看非核心选项)。 Here is the GitHub for the extension. 是扩展的GitHub。

The browser support isn't very good yet, but it's something to watch for the future, for sure. 浏览器的支持还不是很好,但肯定是值得关注的未来。

It's also not bulletproof for your needs, as even an iPod touch or a phone without a dataplan can call out via VoIP over wifi, but wouldn't register as having a "connection" (I assume). 它也不能满足您的需求,因为即使是iPod touch或没有数据片的手机也可以通过WiFi通过WiFi呼叫,但不会注册为“连接”(我假设)。 This may not be possible for while, I'm not sure how you'd know for sure that any given device could or couldn't dial out. 这可能是不可能的,虽然,我不确定你怎么知道任何给定的设备可以或不能拨出。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM