Document Taobao launch link examples

main
wangqiyang 3 weeks ago
parent 37509de25c
commit aefffa2e6c

@ -1 +1,167 @@
# 淘宝 App 唤起链接测试小抄
说明:
- 下面这些链接用于测试“手机浏览器 / H5 页面 / Android Chrome”唤起淘宝 App。
- 成功率会受手机系统、浏览器、淘宝版本、是否安装淘宝影响。
- 最稳的方式是放在用户明确点击的按钮里触发,不要页面自动跳转。
- 微信、QQ 等内置浏览器经常会拦截 scheme / intent 链接。
## 1. 最简单的淘宝唤起
直接尝试打开淘宝:
```text
taobao://m.taobao.com/ taobao://m.taobao.com/
```
淘宝常见 tbopen scheme
```text
tbopen://m.taobao.com/
```
兜底网页版:
```text
https://m.taobao.com/
```
## 2. Android Chrome intent 写法
Android Chrome 中推荐测试这个,已安装淘宝时尝试拉起淘宝,未安装时回落到手机淘宝 H5
```text
intent://m.taobao.com/#Intent;scheme=tbopen;package=com.taobao.taobao;S.browser_fallback_url=https%3A%2F%2Fm.taobao.com%2F;end
```
使用 taobao scheme 的 Android intent 变体:
```text
intent://m.taobao.com/#Intent;scheme=taobao;package=com.taobao.taobao;S.browser_fallback_url=https%3A%2F%2Fm.taobao.com%2F;end
```
## 3. H5 页面包装打开
用淘宝 App 内置容器打开 H5 页面:
```text
taobao://m.taobao.com/tbopen/index.html?h5Url=https%3A%2F%2Fm.taobao.com%2F
```
```text
tbopen://m.taobao.com/tbopen/index.html?h5Url=https%3A%2F%2Fm.taobao.com%2F
```
把 `h5Url=` 后面的地址换成 URL 编码后的网页地址即可,例如:
```text
tbopen://m.taobao.com/tbopen/index.html?h5Url=https%3A%2F%2Fwww.taobao.com%2F
```
## 4. 常见淘宝页面
商品详情,替换 `{item_id}`
```text
taobao://item.taobao.com/item.htm?id={item_id}
```
搜索,替换 `{keyword}`
```text
taobao://s.taobao.com/search?q={keyword}
```
购物车:
```text
taobao://cart.taobao.com/my_cart.htm
```
我的淘宝:
```text
taobao://my.m.taobao.com/myTaobao.htm
```
我的订单:
```text
taobao://go/my_orders
```
消息:
```text
taobao://message/root
```
拍照搜索:
```text
taobao://h5.m.taobao.com/tusou/capture.html
```
店铺页,替换 `{shop_id}`
```text
tbopen://shop.m.taobao.com/shop/shop_index.htm?shopId={shop_id}
```
店铺页变体,替换 `{shop_id}`
```text
tbopen://fshop.m.taobao.com/shop/shop_index.htm?shopId={shop_id}
```
## 5. H5 a 标签示例
普通 scheme
```html
<a href="taobao://m.taobao.com/">打开淘宝</a>
```
tbopen scheme
```html
<a href="tbopen://m.taobao.com/">打开淘宝 tbopen</a>
```
Android Chrome intent
```html
<a href="intent://m.taobao.com/#Intent;scheme=tbopen;package=com.taobao.taobao;S.browser_fallback_url=https%3A%2F%2Fm.taobao.com%2F;end">Android Chrome 打开淘宝</a>
```
## 6. H5 按钮点击示例
```html
<button id="openTaobao">打开淘宝</button>
<script>
const isAndroid = /Android/i.test(navigator.userAgent);
document.getElementById("openTaobao").addEventListener("click", () => {
if (isAndroid) {
location.href = "intent://m.taobao.com/#Intent;scheme=tbopen;package=com.taobao.taobao;S.browser_fallback_url=https%3A%2F%2Fm.taobao.com%2F;end";
return;
}
location.href = "tbopen://m.taobao.com/";
});
</script>
```
## 7. 测试建议
优先测试顺序:
```text
1. Android Chrome 打开 intent:// 链接
2. 手机自带浏览器打开 tbopen:// 或 taobao:// 链接
3. Safari / Chrome 中点击 H5 a 标签
4. 失败后回落到 https://m.taobao.com/
```
不要依赖页面加载后自动跳转,最好让用户点“打开淘宝”按钮。自动跳转更容易被浏览器或平台拦截。

Loading…
Cancel
Save