我们正在使用注册自己的协议的软件。我们可以从浏览器运行应用程序,然后通过以下链接:customprotocol://do_this.但是有没有办法检查用户系统是否支持这种自定义协议?如果不是,我们想请用户先安装软件。例如:if (canHandle ('customprotocol')) { // run software}else { // ask to install}编辑 我知道关于protocolLong属性,但是它仅在IE中有效。
3 回答
拉风的咖菲猫
TA贡献1995条经验 获得超2个赞
Windows 8上的Internet Explorer 10引入了非常有用的navigator.msLaunchUri方法,用于启动自定义协议URL并检测成功或失败。例如:
if (typeof (navigator.msLaunchUri) == typeof (Function)) {
navigator.msLaunchUri(witchUrl,
function () { /* Success */ },
function () { /* Failure */ showError(); });
return;
}
Windows 7 / IE 9及以下版本支持@ mark-kahn建议的条件注释。
添加回答
举报
0/150
提交
取消