How To Get Screen Resolution

RegisterLogin
How To Get Screen Resolution
Post Description: This Tutorial Will Show You How You Can Obtain The Screen Resolution Settings For A Users Who Is Visiting Your Website
Tags: How, To, Get, Screen, Resolution
This Post Was Posted On Dec 06, 2009 By Webune Tutorials #2850
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>&nbsp;</p></body></html>


now save the file as webune-resolution.html and open it with your browser..

Thanks
Webune Support Team

Download File: webune-resolution.html
Leave Your Comments
Related Pages: [Add Your Website]
Post New Topic
Graham
#4626 1
great, wish is was a function to i could set a session array var that = the two values. i'll now have to find out how to convert it into a funtion, but this does help... thanks
Nov 17, 2010 Reply Report abuse
Ole
#4586 2
cool script. thank you
Nov 02, 2010 Reply Report abuse
steff
#4551 3
asta la vista baby
Oct 22, 2010 Reply Report abuse
matthew
#4248 4
how do i download this leave your comments script
Jul 25, 2010 Reply Report abuse
bleter
#3784 5
did you know that finding screen resolution from server side is no possible?

why?

because, the information is coming from the client not the server itself, so its impossible to get the screen size with php, you will have to use javascript,

but you can use javascript in combination with php or asp to save the user's screen size
Apr 17, 2010 Reply Report abuse
Leave Your Comments...
©2011 Webune Forums - Sun Dec 18, 2011 6:42 pm
Powered by: Webune Forums V3