【前端】IOS无法跳转问题

 1 <!DOCTYPE html>
 2 <html>
 3     <head>
 4         <meta http-equiv="content-type" content="text/html; charset=utf-8" />
 5         <title>IOS无法跳转问题</title>
 6     </head>
 7     <body>
 8     <!--IOS无法跳转问题-->
 9     </body>
10     <script type="text/javascript">
11         let u = navigator.userAgent
12         let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1
13         let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)
14 
15         if (isIOS) {
16             window.location.href = "https://www.baidu.com/";
17         } else if (isAndroid) {
18             window.open("https://www.baidu.com/");
19         }
20     </script>
21 </html>

 

posted @ 2023-05-15 17:05  莫相离灬  阅读(22)  评论(0编辑  收藏  举报