android/iphone点击在html中调用
我正在为 Android 和 Android 创建一个 HTML 移动网站iOS 设备。 我知道点击呼叫两者。
ANDROID
<a href="tel:2125551212">2125551212</a>
iOs
<a href="callto:2821229627-7877">Live Support</a>
现在,我的问题是我有一个带有点击通话链接的网页,并且希望该链接适用于 android / ios
I am creating one HTML mobile website for android & ios device.
I know click to call for both.
ANDROID
<a href="tel:2125551212">2125551212</a>
iOs
<a href="callto:2821229627-7877">Live Support</a>
Now, my problem is i have one webpage with click to call link and want that link work for both android / ios
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
只需使用
tel:
即可在 iOS、Android、blackbarry 操作系统、Windows 等上运行。使用此方案将适用于几乎所有移动浏览器。Just use
tel:
it will work on iOS, android, blackbarry OS, windows and many more. Using this scheme will work on almost all mobile browsers on.你必须认识客户。由于不同的手机有不同的用户代理,您可以使用 JavaScript 执行以下操作:
You have to recognize the client. Since different phones have different user agents, you can do something like this with JavaScript:
这对我也有用。
这样做的问题是它会破坏人们可能在桌面浏览器上使用的附加组件和扩展。
对于 Android 操作系统,点击后即可拨打普通电话号码。
您还可以使用 AdWords 跟踪此通话。我正在努力让它与 Google Analytics 一起使用。
This works for me as well.
The problem with this is it will break add-ons and extensions that people may use on desktop browsers.
The plain phone number will call on click for Android OS.
You can also track this call with AdWords. I am working on getting it to work with Google Analytics.
关于 MoyShe 的帖子而不是窃取她的代码(补充),我将使用默认的 else 语句为桌面浏览器和其他浏览器添加条件默认值。
这样,桌面浏览器用户还可以看到电话号码,因为如果该设备不属于所查询的两个手持设备,则默认情况下会显示电话号码。
我不熟悉android、blackberry、IO、windows等...但我也想问或指出我的评论部分。
(对于 Newbs - 粘贴到网页中时可以删除上面的注释代码行)。
黑莓和所有其他设备操作系统呢?它们是 Android 还是 IO 驱动的操作系统?如果不是,还需要创建专门识别这些设备的附加代码并将其包含在(else if)语句中。
如果我的未知问题是正确的,Switch/Case 语句可能会更干净,也是更好的方法。
In regards to MoyShe's post and not to steal her code (complements) I would add a conditional default for Desktop browsers and other as well using a default else statement.
That way desktop browsers users could also see a phone number as it would display a phone number by default if the device is not of the two handheld device queried.
I am not versed in android, blackberry, IOs, windows, etc...but I would also like to ask or point out my comment section.
(For Newbs- the above line of commented code can be removed when pasting in the web page).
What about blackberry and all the other device OS's? Are they Android or IOs driven OS's? If not, additional code to specifically identify those devices would also need to be created and included in the (else if's) statements.
If I am correct in my unknown question, a Switch/Case statement might be cleaner and a better way to go.
如上
Msaccess 澳大利亚帮助www.msaccess.com.au
您只想在 PC 浏览器上显示普通文本
因此,将此行放入您的页面
文件中
并将以下内容保存在名为 javascript.js的 别忘了更改号码:)
as on
Msaccess Help Australia www.msaccess.com.au
You only want ordinary text showing on a PC browsers
so put this line in your page
<script type="text/javascript" src="javascript.js"></script>
and save the below in a file called javascript.js
don't forget to change the number :)