bạn có thể sử dụng 51Degrees' giải pháp đám mây miễn phí dựa để có được thông tin này. Là một phần của dịch vụ đám mây miễn phí, bạn có quyền truy cập vào thuộc tính BrowserName bao gồm Chrome dành cho iO.
Một số mã mẫu bạn có thể sử dụng ở bên dưới. Bạn có thể lấy chìa khóa đám mây miễn phí bằng cách đi qua trang cửa hàng ở đây https://51degrees.com/products/store/rvdsfcatid/cloud-device-detection-7
<!DOCTYPE html>
<html>
<body>
<p id="id01"></p>
<script>
var xmlhttp = new XMLHttpRequest();
<!-- Insert Cloud key here. -->
var key = "Licence Key"
<!-- Receives UserAgent from clients connection. -->
var ua = window.navigator.userAgent;
<!-- Lists the properties required. -->
var url = ("https://cloud.51degrees.com/api/v1/"+key+"/match?user-agent="+ua+"&Values=\
BrowserName");
<!-- Parses the JSON object from our cloud server and returns values. -->
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4 && xmlhttp.status == 200){
var match = JSON.parse(xmlhttp.responseText);
var text = ""
document.getElementById("id01").innerHTML=\
"UserAgent:"+ua+"</br>"+
"BrowserName:"+match.Values.BrowserName;
}
}
<!-- Sends request to server. -->
xmlhttp.open("GET", url, true);
xmlhttp.send();
</script>
</body>
</html>
Để biết thêm thông tin về việc sử dụng API Javascript Đám mây mà bạn có thể xem thêm hướng dẫn tại đây https://51degrees.com/Developers/Documentation/APIs/Cloud-API/JavaScript-Cloud
Tiết lộ: Tôi làm việc tại 51Degrees
Tại sao bạn cần thực hiện việc này? – Blender
tôi cần điều này cho các hiệu ứng hình ảnh đặc biệt chỉ hiển thị trên máy tính để bàn – cr1msaun
Phát hiện xem trình duyệt có hỗ trợ chạm hay không và áp dụng lớp cho phần tử 'body'. Modernizr làm điều này. – Blender