【发布时间】:2014-08-19 07:37:58
【问题描述】:
我将按以下格式向我的客户发送应用程序的链接
http://goo.gl.com/downloadtheapp(或其他)
我希望此文件位于我的服务器上的某个位置,其中包含检查设备类型并重定向到便利店的 java 脚本代码。也就是说,如果设备是基于 android 的,则使用 google play;如果设备基于 ios,则使用 appstore。
到现在我都试过了,但还是不行。
<html>
<head>
<script type="text/javascript">
$(document).ready(function ()
{
if(navigator.userAgent.toLowerCase().indexOf("android") > -1)
{
window.location.href = 'http://play.google.com/store/apps/details?id=com.truecaller&hl=en';
}
if(navigator.userAgent.toLowerCase().indexOf("iphone") > -1)
{
window.location.href = 'http://itunes.apple.com/lb/app/truecaller-caller-id-number/id448142450?mt=8';
}
}
</javascript>
</head>
<body>
</body>
</html>
【问题讨论】:
-
尝试用
</script>替换</javascript> -
另外,如下所述,您的脚本末尾缺少右括号。
标签: javascript android jquery html ios