繁体   English   中英

IOS Safari 检测Skype

[英]IOS Safari detect Skype

在 iPhone 上,是否可以在网页上检测是否安装了 Skype?

我问的原因是我想基于此更改链接的 href:如果未安装 Skype,则显示一个弹出窗口,说明 Skype 是什么以及如何安装它,如果已安装,请将链接更改为skype:my.contact.name?call所以点击将开始通话。

我已经尝试过在Javascript 之前讨论过的解决方案来检测 Skype ,但它只适用于桌面浏览器,但不适用于移动设备。

这是确定是否安装了Skype的逻辑。 在 else 语句中,您处理您希望如何呈现安装说明来安装 Skype。 显然,只要您在每个应用程序的基础上相应地更新 url 方案,这将适用于为 iOS 应用程序实施的任何自定义 url 方案。

NSString *contactName = @"user123";
NSURL *skypeURL = [NSURL URLWithString:[NSString stringWithFormat:@"skype://%@?call", contactName]];
if ([[UIApplication sharedApplication] canOpenURL:skypeURL]) {
  [[UIApplication sharedApplication] openURL:skypeURL];
} else {
  // Display to the user how to install skype.
}

更新:

我刚刚注意到该标签是针对Mobile-Safari 的,所以我认为这是在寻找基于 Web 的解决方案。 我认为你想要达到的目标是不可能的。 The only way I can think about doing it was having an XMLHTTPRequest call the URL to see if the URL causes an error 404. The problem is any domain your executing the Javascript code from will not have the skype:// scheme in it and will无疑会引发安全错误。 这是因为 Javascript 不允许 XMLHttpRequest 到 go 进入托管代码的源域以外的域。

暂无
暂无

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

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