How to check resolution of laptop/computer using JavaScript?

Hi guys,

Today we will see how to check resolution of laptop/computer using JavaScript.

To check screen width and height, we have default functions in JavaScript.

They are:

1.screen.width – to check the screen width

2.screen.height – to check the …


This content originally appeared on DEV Community and was authored by pavankumarsadhu

Hi guys,

Today we will see how to check resolution of laptop/computer using JavaScript.

To check screen width and height, we have default functions in JavaScript.

They are:

1.screen.width - to check the screen width

2.screen.height - to check the screen height

<script>
var width = screen.width;
var height = screen.height;
//prints output in console
console.log(width+"x"+height); // my output: 1366x768
</script>

In this way, we can check the user laptop/computer resolution.

Thanks for taking your valuable time for reading my post, if you have any queries , please leave a comment and will respond. If you find this post useful, please share it.

Read: Can we store php variable in javascript?

Social Profile : LinkedIn

Have a Nice Day!


This content originally appeared on DEV Community and was authored by pavankumarsadhu


Print Share Comment Cite Upload Translate Updates
APA

pavankumarsadhu | Sciencx (2021-08-30T16:15:09+00:00) How to check resolution of laptop/computer using JavaScript?. Retrieved from https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/

MLA
" » How to check resolution of laptop/computer using JavaScript?." pavankumarsadhu | Sciencx - Monday August 30, 2021, https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/
HARVARD
pavankumarsadhu | Sciencx Monday August 30, 2021 » How to check resolution of laptop/computer using JavaScript?., viewed ,<https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/>
VANCOUVER
pavankumarsadhu | Sciencx - » How to check resolution of laptop/computer using JavaScript?. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/
CHICAGO
" » How to check resolution of laptop/computer using JavaScript?." pavankumarsadhu | Sciencx - Accessed . https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/
IEEE
" » How to check resolution of laptop/computer using JavaScript?." pavankumarsadhu | Sciencx [Online]. Available: https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/. [Accessed: ]
rf:citation
» How to check resolution of laptop/computer using JavaScript? | pavankumarsadhu | Sciencx | https://www.scien.cx/2021/08/30/how-to-check-resolution-of-laptop-computer-using-javascript/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.