对于ios,首先想到的是根据页面的js找到对应的universal link。ios9以下和安卓就用schema跳转。
对于京东的链接 https://pro.m.jd.com/mall/active/3pR34myNmV7cXiR4DjzUSRuu5hqA/index.html?ad_od=1&utm_source=kong&utm_medium=zssc&utm_campaign=t_1000210271_100854&utm_term=ea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854&jd_pop=ea62df13-dc13-44c8-ae00-59b5683ec8f2&abt=0 分析源码https://st.360buyimg.com/common/commonH_B/js/m_common_merge2.1.js 网上还找到这个版本的js
1 | aE(e.openAppBtnId, "click", function() { |
1 | function az(aS) { |
测试发现根据代码获得universal link只能打开京东的首页https://linkst.m.jd.com/ul/ul.action?openApp.jdMobile://virtual?params={"category":"jump","des":"m","sourceValue":"babel-act","sourceType":"babel","url":"https%3A%2F%2Fpro.m.jd.com%2Fmall%2Factive%2F3pR34myNmV7cXiR4DjzUSRuu5hqA%2Findex.html%3Fad_od%3D1%26utm_source%3Dkong%26utm_medium%3Dzssc%26utm_campaign%3Dt_1000210271_100854%26utm_term%3Dea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854%26jd_pop%3Dea62df13-dc13-44c8-ae00-59b5683ec8f2%26abt%3D0","M_sourceFrom":"H5_UL","msf_type":"click","NoJumpDownLoadPage":false,"downAppIos":"https%3A%2F%2Fst.360buyimg.com%2Fcommon%2FdownLoadCommon%2FdownLoadAppIOSMPage.html","locationHref":"https%3A%2F%2Fpro.m.jd.com%2Fmall%2Factive%2F3pR34myNmV7cXiR4DjzUSRuu5hqA%2Findex.html%3Fad_od%3D1%26utm_source%3Dkong%26utm_medium%3Dzssc%26utm_campaign%3Dt_1000210271_100854%26utm_term%3Dea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854%26jd_pop%3Dea62df13-dc13-44c8-ae00-59b5683ec8f2%26abt%3D0","m_param":{"m_source":"0","event_series":{},"jda":"122270672.2074471510.1521534916.1522766295.1522991099.5","usc":"kong","ucp":"t_1000210271_100854","umd":"zssc","utr":"ea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854","jdv":"122270672%7Ckong%7Ct_1000210271_100854%7Czssc%7Cea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854%7C1522991529755","ref":"https%3A%2F%2Fpro.m.jd.com%2Fmall%2Factive%2F3pR34myNmV7cXiR4DjzUSRuu5hqA%2Findex.html%3Fad_od%3D1%26utm_source%3Dkong%26utm_medium%3Dzssc%26utm_campaign%3Dt_1000210271_100854%26utm_term%3Dea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854%26jd_pop%3Dea62df13-dc13-44c8-ae00-59b5683ec8f2%26abt%3D0","psn":"2074471510|5","psq":14,"unpl":"V2_ZzNsbRBVFkAiXE9dZx5dVTUfFwlEUV9FdwFHSClNDgFkURpaF1MXQWlJKFRzEVQZJkB8XUNRRAklTShUehhVAWIzEVxCXl8UdxREVWoaXw5mBRldRGdDJXUJR1V4GV0GYQMibXJXQSV0OEVVfRxZA2cHElxyURNHdV1PBC8FCVJvAw5YRABBCSYIE1JnGQhWbwQRW0FQQ0ImOEBS","pc_source":"","mba_muid":"2074471510","mba_sid":"15229910996761532999810513868","mt_xid":"","mt_subsite":""},"SE":{"mt_subsite":"","__jdv":"122270672%7Ckong%7Ct_1000210271_100854%7Czssc%7Cea62df13-dc13-44c8-ae00-59b5683ec8f2-p_1999-pr_1076-at_100854%7C1522991529755","unpl":"V2_ZzNsbRBVFkAiXE9dZx5dVTUfFwlEUV9FdwFHSClNDgFkURpaF1MXQWlJKFRzEVQZJkB8XUNRRAklTShUehhVAWIzEVxCXl8UdxREVWoaXw5mBRldRGdDJXUJR1V4GV0GYQMibXJXQSV0OEVVfRxZA2cHElxyURNHdV1PBC8FCVJvAw5YRABBCSYIE1JnGQhWbwQRW0FQQ0ImOEBS","__jda":"122270672.2074471510.1521534916.1522766295.1522991099.5"}}
初步怀疑:
- 是不是参数没有encode
- schema的大小写是不是有问题
猜测的结论
- 京东和微信的关系,京东的schema是白名单,打开App没有限制,而对universal link 的测试不充分,导致相应的链接有问题
通过测试其他的app打开京东的页面,首次有弹框是否打开京东的提示,确认后下次就没有,然而美妆心得的App就是无反应。
近期苹果公司iOS 9系统策略更新,限制了http协议的访问,此外应用需要在“Info.plist”中将要使用的URL Schemes列为白名单,才可正常检查其他应用是否安装。 来自 https://www.jianshu.com/p/a8cce94d508e
定位代码1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27e.exports = function(e) {
var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {};
if ("TB" != n.aliapp.appname && "TB-PD" != n.aliapp.appname) {
t.point = t.point || {},
t.point.callType = t.callType;
var a = (0,
r.default)(e, t)
, s = {
package: "com.taobao.taobao"
};
switch (t.callType) {
case "universalLink":
if (n.os.isIPhone && n.os.version.gte("9.0")) {
var l = (0,
o.appendParams)(t.universalLink || "//b.mashort.cn/ulk/taobao", {
smburl: encodeURIComponent(a)
});
t.redirectUrl && (l = (0,
o.appendParams)(l, {
redirectUrl: encodeURIComponent(t.redirectUrl)
})),
(0,
i.default)(l, "universalLink")
} else
(0,
i.default)(a, "scheme", s);
break;
获得的universal link。测试发现其实分享的淘宝口令http://m.tb.cn/h.WE82pie本身就是universal link
扩展阅读
- MobLink网页跳转app指定界面技术简介之 URL Scheme
- 突破微信跳转限制-Universal-Links那些坑
- 关于通过H5页面唤起Native客户端的介绍
- Universal links 介绍