index.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <!doctype html>
  2. <html lang="">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width,initial-scale=1">
  7. <meta name="viewport" content="initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no">
  8. <link rel="icon" href="favicon.ico">
  9. <title>Caner</title>
  10. </head>
  11. <body>
  12. <div id="app"></div>
  13. <script>
  14. // 先判断是苹果还是安卓
  15. window.onload = function() {
  16. const isIOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
  17. const isAndroid = navigator.userAgent.includes('Android') || navigator.userAgent.includes('Linux') // g
  18. if (isIOS) {
  19. window.location.href = 'https://m.music.163.com/m/applink/?scheme=orpheus://song/2000381011?market=baiduqk'
  20. }
  21. if (isAndroid) {
  22. // 创建a标签自动点击跳转
  23. const aLink = document.createElement('a')
  24. aLink.href = 'orpheus://song/2000381011?market=baiduqk'
  25. let event
  26. if (window.MouseEvent) event = new MouseEvent('click')
  27. else {
  28. event = document.createEvent('MouseEvents')
  29. event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
  30. }
  31. aLink.dispatchEvent(event)
  32. }
  33. }
  34. </script>
  35. </body>
  36. </html>