Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> HTML

Thuộc tính navigator.appVersion trong HTML

Thuộc tính navigator.appVersion trả về thông tin phiên bản của trình duyệt.

Cú pháp

navigator.appVersion

Ví dụ

Ví dụ hiển thị thông tin phiên bản trình duyệt:

<!DOCTYPE html>
<html>
<style>
  body {
    color: #000;
    height: 100vh;
    background: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%) no-repeat;
    text-align: center;
  }
  .btn {
    background: #db133a;
    border: none;
    height: 2rem;
    border-radius: 20px;
    width: 330px;
    display: block;
    color: #fff;
    outline: none;
    cursor: pointer;
    margin: 1rem auto;
  }
  .show {
    font-size: 1.5rem;
    color: #fff;
  }
</style>
<body>
<h1>Demo thuộc tính navigator.appVersion</h1>
<button class="btn" onclick="display()">Hiển thị phiên bản trình duyệt</button>
<div class="show"></div>
<script>
  function display() {
    document.querySelector(".show").innerHTML = 
      "<p>Thông tin phiên bản trình duyệt:</p>" +
      "<p>" + navigator.appVersion + "</p>";
  }
</script>
</body>
</html>

Kết quả

Nhấn nút "Hiển thị phiên bản trình duyệt" để xem chuỗi phiên bản chi tiết của trình duyệt hiện tại.

Lưu ý: Chuỗi này có thể chứa thông tin về engine, hệ điều hành và phiên bản trình duyệt.