1. <script>
    2. //判断手机环境
    3. var u = navigator.userAgent, app = navigator.appVersion;
    4. var isAndroid = u.indexOf('Android') > -1
    5. || u.indexOf('Linux') > -1; //android终端或者uc浏览器
    6. var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    7. var isiosapp = u.indexOf('Safari') == -1
    8. && u.indexOf('Language') == -1
    9. && u.indexOf('MicroMessenger') == -1;
    10. var isanapp = u.indexOf('igetapp') > -1;
    11. //微信
    12. function is_weixn() {
    13. var ua = navigator.userAgent.toLowerCase();
    14. if (ua.match(/MicroMessenger/i) == "micromessenger") {
    15. return true;
    16. } else {
    17. return false;
    18. }
    19. ;
    20. };
    21. //外部点击按钮直接跳转回APP指定页面
    22. if (is_weixn()) {
    23. if (isiOS) {
    24. $('#join').click(function () {
    25. // window.location="https://ttts.besttoptoday.com/dl/blue.html?urlurlurl=besttoptoday.com/static/weekw/20200220/86855.html"
    26. window.location = "https://ttts.besttoptoday.com/dl/blue.html?need_login=ture&type=25"
    27. })
    28. } else if (isAndroid) {
    29. var link = 'https://anyx52.jmlk.co/AA2m';//短链地址
    30. var configs = [];
    31. var btn_1 = document.querySelector('#join');
    32. configs.push({
    33. //jmlink: link+'?push_id=https://ttts.besttoptoday.com/dl/blue.html?urlurlurlbesttoptoday.com/static/weekw/20200220/86855.html',
    34. //安卓不需要在urlurlurl后边写=
    35. jmlink: link+'?type=25',
    36. button: btn_1
    37. })
    38. new JMLink(configs);
    39. }
    40. }
    41. // 安卓浏览器
    42. if (isAndroid && !is_weixn()) {
    43. var link = 'https://anyx52.jmlk.co/AA2m';//短链地址
    44. var configs = [];
    45. var btn_1 = document.querySelector('#join');
    46. configs.push({
    47. //jmlink: link+'?push_id=https://ttts.besttoptoday.com/dl/blue.html?urlurlurlbesttoptoday.com/static/weekw/20200220/86855.html',
    48. //安卓不需要在urlurlurl后边写=
    49. jmlink: link+'?type=25',
    50. button: btn_1
    51. })
    52. new JMLink(configs);
    53. }
    54. // ios浏览器
    55. if (!isiosapp && isiOS && !is_weixn()) {
    56. $('#join').click(function () {
    57. // window.location="https://ttts.besttoptoday.com/dl/blue.html?urlurlurl=besttoptoday.com/static/weekw/20200220/86855.html"
    58. window.location = "https://ttts.besttoptoday.com/dl/blue.html?need_login=ture&type=25"
    59. })
    60. }
    61. </script>