उदाहरण
स्क्रीन रेजोल्यूशन जानने के लिए window.screen ऑब्जेक्ट का उपयोग करें।
// चौड़ाई के लिए window.screen.availWidth // ऊंचाई के लिए window.screen.availHeight
पूरा कोड:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
console.log("Available Width=" + window.screen.availWidth);
console.log("Available Height=" + window.screen.availHeight);
</script>
</body>
</html>
फ़ाइल सेव करें और Live Server से खोलें।
आउटपुट
कंसोल में स्क्रीन की उपलब्ध चौड़ाई और ऊंचाई दिखाई देगी।