UserAgent:用来识别浏览器名称,版本,引擎以及操作系统等信息的内容。
Code:
<body><script>console.log(navigator.userAgent)//Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36</script></body>
Code:
<body><p>pc</p><script>if(/Android|iphone|webOS/i.test(navigator.userAgent)){location.href="html/mobile.html"}else if(/ipad/i.test(navigator.userAgent)){location.href="html/pad.html"}</script></body>
