如何实现一个二维码跳转到连个应用市场(自动识别 Android 和 ios)?

2014-12-19 09:22:37 +08:00
 jwangkun
我的想法是做一个页面通过js判断一下,然后识别后自动跳转,有没有有其他的更好的办法?js实现的话怎么写js自动识别ios Andriod?能贴上代码最好,谢谢
5367 次点击
所在节点    问与答
4 条回复
jwangkun
2014-12-19 09:30:28 +08:00
<html>
<title></title>
<head></head>
<body>
<script type="text/javascript">
var browser = {
versions: function () {
var u = navigator.userAgent, app = navigator.appVersion;
return { //移动终端浏览器版本信息
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
iPad: u.indexOf('iPad') > -1, //是否iPad
};
}(),
}
if (browser.versions.iPhone || browser.versions.iPad || browser.versions.ios) {
window.location.href = "https://itunes.apple.com/cn/app/qq/id444934666?mt=8&v0=WWW-GCCN-ITSTOP100-FREEAPPS&l=&ign-mpt=uo%3D4";
}
if (browser.versions.android) {
window.location.href = "http://www.qq.com";
}
</body>
</html>
这样行吗
WildCat
2014-12-19 09:32:12 +08:00
kookxiang
2014-12-19 11:28:08 +08:00
最好直接用302跳转吧,也是判断浏览器UA跳转
xwsoul
2014-12-19 12:02:32 +08:00
简单说就是二维码进landing page, Landing page 识别定向转发

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/155022

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX