-1

我如何查看用户是从 safari 还是从 Web Clip 打开我的网站?
我尝试搜索,但找不到该信息。提前致谢!;-)

4

1 回答 1

0

原答案链接

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
function getBrowser() {
  if( navigator.userAgent.indexOf("Chrome") != -1 ) {
    return "Chrome";
  } else if( navigator.userAgent.indexOf("Opera") != -1 ) {
    return "Opera";
  } else if( navigator.userAgent.indexOf("MSIE") != -1 ) {
    return "IE";
  } else if( navigator.userAgent.indexOf("Firefox") != -1 ) {
    return "Firefox";
  } else if( navigator.userAgent.indexOf("Safari") != -1 ) {
    return "Safari";
  } else {
    return "unknown";
  }
}
document.getElementById("demo").innerHTML = getBrowser();
</script>

</body>
</html>
于 2021-10-01T17:53:07.693 回答