amazon-redirect
<style>
body {
margin: 0;
background: #ffffff;
font-family: Arial, sans-serif;
}
.bridge-wrap {
max-width: 520px;
margin: 0 auto;
min-height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
padding: 20px;
box-sizing: border-box;
position: relative;
}
.close-btn {
position: absolute;
top: 18px;
left: 18px;
font-size: 28px;
color: #222;
cursor: pointer;
line-height: 1;
}
.product-img {
width: 100%;
border-radius: 18px;
display: block;
}
.title {
margin-top: 18px;
font-size: 24px;
font-weight: bold;
color: #111;
line-height: 1.3;
}
.desc {
margin-top: 10px;
font-size: 15px;
color: #666;
line-height: 1.6;
}
.cta-btn {
margin-top: 28px;
width: 100%;
border: none;
background: #000;
color: white;
height: 56px;
border-radius: 14px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
}
.loading {
margin-top: 18px;
font-size: 13px;
color: #888;
text-align: center;
}
</style>
<div class="bridge-wrap">
<div class="close-btn">×</div>
<img
class="product-img"
src="https://m.media-amazon.com/images/I/61op0HPe+-L._AC_SY535_.jpg"
/>
<div class="title">
Opening Amazon App...
</div>
<div class="desc">
Tap the button below to continue securely to Amazon.
</div>
<button class="cta-btn" id="openAmazon">
Open in Amazon
</button>
<div class="loading">
Secure connection...
</div>
</div>
<script>
const AMAZON_URL =
"https://www.amazon.com/dp/B0DT9LTDJJ";
/**
* TikTok Browser 检测
*/
function isTikTokBrowser() {
return /TikTok/i.test(navigator.userAgent);
}
/**
* iOS 检测
*/
function isIOS() {
return /iPhone|iPad|iPod/i.test(navigator.userAgent);
}
/**
* Android 检测
*/
function isAndroid() {
return /Android/i.test(navigator.userAgent);
}
/**
* 主跳转逻辑
*/
function openAmazon() {
console.log("bridge_click");
/**
* TikTok Browser 内
* 直接使用 HTTPS
* 系统会自动尝试打开 Amazon App
*/
if (isTikTokBrowser()) {
window.location.href = AMAZON_URL;
return;
}
/**
* iOS Safari
*/
if (isIOS()) {
window.location.href = AMAZON_URL;
return;
}
/**
* Android Chrome
*/
if (isAndroid()) {
const intentUrl =
"intent://www.amazon.com/dp/B0DT9LTDJJ#Intent;" +
"scheme=https;" +
"package=com.amazon.mShop.android.shopping;" +
"end";
window.location.href = intentUrl;
/**
* fallback
*/
setTimeout(() => {
window.location.href = AMAZON_URL;
}, 1800);
return;
}
/**
* Desktop fallback
*/
window.location.href = AMAZON_URL;
}
/**
* 自动触发(轻延迟)
*/
setTimeout(() => {
/**
* 不直接强跳
* 而是模拟用户行为前的预热
*/
document.getElementById("openAmazon")
.classList.add("active");
}, 400);
/**
* 用户点击触发(关键)
*/
document
.getElementById("openAmazon")
.addEventListener("click", openAmazon);
/**
* 可选:
* 自动模拟点击(部分环境有效)
*/
setTimeout(() => {
try {
document
.getElementById("openAmazon")
.click();
} catch (e) {}
}, 900);
</script>