如果用户从safari或从Web Clip打开我的网站,我该如何查看?
我试着搜索,但是我没有找到那个信息。提前感谢!: -)
原始答案Link
<!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>