通过扫二维码,进到网页之后,判断设备,跳转不同网页。 window.navigator.userAgent用来区分设备和浏览器
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | <! DOCTYPE html> < html lang="en"> < head > < meta charset="UTF-8"> < meta name="viewport" content="width=device-width, initial-scale=1.0"> < meta http-equiv="X-UA-Compatible" content="ie=edge"> < meta name="viewport" content="viewport-fit=cover,width=device-width,height=device-height,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"> < title >个人所得税</ title > < link rel="shortcut icon" href=/zrr/images/favicon.ico type=image/x-icon> < style > .download-layout{ width: 100%; height: 80vh; background-size: contain; background-position-x: center; background-repeat: no-repeat; background-image: url('./375_667.png'); } .device-tips { display: none; position: fixed; top: 0; left: 0; background-color: #fff9e1; color: #f90; padding: 8px 16px; font-size: 14px; line-height: 20px; } .download-btn { text-decoration: none; display: block; height: auto; width: 78%; border-radius: 4px; padding: 8px 12px; margin: 0 auto; font-size: 17px; line-height: 23px; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-user-select: none; background-color: #4285f4; color: #fff; text-align: center; } </ style > < script > var IOS_REG_EXP = /iPhone/; // 需配置 var IPA_DOWNLOAD_URL = 'https://itunes.apple.com/cn/app/个人所得税/id1436002627?l=zh&ls=1&mt=8'; var ANDROID_REG_EXP = /Android/; // 需配置 var APK_DOWNLOAD_URL = '/download/its.apk'; // wechat var WECHAT_CLIENT_EXP = /MicroMessenger/; // alpay var ALIPAY_CLIENT_EXP = /AlipayClient/; setTimeout(function() { var ua = window.navigator.userAgent; if (ANDROID_REG_EXP.test(ua) && (WECHAT_CLIENT_EXP.test(ua) || ALIPAY_CLIENT_EXP.test(ua))) { document.querySelector('.J_DeviceTips').style.cssText = 'display: block;' } }, 300); function redirectDownload() { var ua = window.navigator.userAgent; // console.log(ua); var url = ''; if (IOS_REG_EXP.test(ua)) { url = IPA_DOWNLOAD_URL; } if (ANDROID_REG_EXP.test(ua)) { url = APK_DOWNLOAD_URL; } if (url) { window.location.href = url; } } </ script > </ head > < body > < div class="download-layout"></ div > < div class="device-tips J_DeviceTips">请点击右上角“…”选择在浏览器中打开本页面;或直接使用手机浏览器扫码下载。</ div > < a href="javascript:;" class="download-btn" onclick="redirectDownload()">下载个人所得税</ a > </ body > </ html > |
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
· 一次Java后端服务间歇性响应慢的问题排查记录
· dotnet 源代码生成器分析器入门
· ASP.NET Core 模型验证消息的本地化新姿势
· 从零开始开发一个 MCP Server!
· ThreeJs-16智慧城市项目(重磅以及未来发展ai)
· .NET 原生驾驭 AI 新基建实战系列(一):向量数据库的应用与畅想
· Ai满嘴顺口溜,想考研?浪费我几个小时
· Browser-use 详细介绍&使用文档