aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

JavaScript - How to Get Screen Resolution of User or Client Machine

Feb 25, 2013

Here I will explain how to Get Monitor screen resolution using JavaScript or Get screen resolution of user in JavaScript.


In previous article I explained Set watermark text for textbox using JavaScript, JavaScript Set Default home page in IE, Mozilla, JavaScript add bookmark link to website and many articles relating to JavaScript, jQuery, SQL, etc. Now I will explain how to get screen resolution of user in JavaScript.

To get user screen resolution we need to write the code like as shown below

<html xmlns="">
<title>Get Screen Resolution using JavaScript</title>
<script type="text/javascript" language="javascript">
function GetResolution(){
document.getElementById("txtWidth").value = screen.width;
document.getElementById("txtHight").value = screen.height;
<body onload="GetResolution();">
<tr><td align="center" colspan="2">
<b><span style="color: #990000;">Your Screen Resolution </span></b></td></tr>
<td>Width :</td>
<td valign="middle"><input type="text" size="5" name="txtWidth" id="txtWidth">px</td>
<td>Height :</td>
<td valign="middle"><input type="text" size="5" name="txtHight" id="txtHight">px</td>
Live Demo

For live demo check below of your screen resolution details

Your Screen Resolution
Width : px
Height : px

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Murali Krishna.S said...

good one..

Unknown said...

Nic one

Anonymous said...

when runat="server" dont show resolution

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.