- Forums
- Javascipt
- How To Get Screen Resolution From My Website Visitors
This Tutorial Will Show You How You Can Obtain The Screen Resolution Settings For A Users Who Is Visiting Your Website [2192], Last Updated: Mon Jun 24, 2024
Webune Tutorials
Sun Dec 06, 2009
5 Comments
1024 Visits
Thank you for visiting Webune Support Forums.
We provide specialized web hosting and web design solutions.
If you are web developer or a webmaster, you are probably visiting this post because you want to know how you can get your visitor's screen resolution. if i am right, then you will find this short tutorial very helpful.
there are many ways to get a user's screen resolution. the best way i know is to use Javascript. there are also ways you can find the user's computer screen resolution with PHP, ASP, JAVA etc. these are server side programming languages, but javascript is a client-side which means its more secured for the user.
here is an example, i will show you what resolutions settings you have on your computer that you are using to read the post:
how did i do it? ok, i will show you, its not secret really, if you want to see the script in action, you can do two things.
1. you can download the zip file below in the attachments sections
2. or you can create the script yourself, if you want to create the script youserlf, follow these steps:
open your favorite text editor. i am using a windows computer, you can use notepad if you are using windows too. so open notepad and copy and paste the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>How to get Screen Resolution</title></head><body><h4>Get Screen Resolution Script By <a href="http://www.webune.com">Webune.com</a></h4><hr /><h1><!--
#### PLEASE DO NOT REMOVE THIS MESSAGE:
#### SCRIPT IS PROVIDED BY WEBUNE.COM
-->
<script type="text/javascript">
<!--
var ScreenWidth=screen.width; var ScreenHeight=screen.height; var ScreenResolution=ScreenWidth+"x"+ScreenHeight; document.write("<span style=\"color:red;text-transform: capitalize;\">your current screen resolution is " + ScreenResolution + "</span>");
--></script></h1><p>This short script provides your computer's screen resolution.<br />We are using Javascript to get your resolution.</p><p>If you liked this script, we would appreciate if you give us your comments, </p><p><a href="http://www.webune.com/forums/how-to-get-screen-resolution.html">Click Here To Add Your Comments And Get Help About This Script</a></p><p><a href="http://www.webune.com">About Webune</a> - Webune provides web hosting for all types of websites, including Linux/Windows Dedicated Servers</p><p align="center"><a href="http://www.webune.com"><img src="http://www.webune.com/images/headers/default_logo.jpg" border="0" /></a></p><p> </p></body></html>
now save the file as webune-resolution.html and open it with your browser..
Thanks
Webune Support Team
webune-resolution.html