# Javascript Check

**URL:** <https://forum.kirupa.com/t/javascript-check/120823>\
**Category:** Uncategorized\
**Created:** [August 27, 2004, 5:48pm UTC](https://forum.kirupa.com/t/javascript-check/120823 "2004-08-27T17:48:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wyclef](https://avatars.discourse-cdn.com/v4/letter/w/65b543/32.png) [@wyclef](https://forum.kirupa.com/u/wyclef)\
**Post date:** [August 27, 2004, 5:48pm UTC](https://forum.kirupa.com/t/javascript-check/120823/1 "2004-08-27T17:48:09Z")

</div>

Hi,

Can someone check this script? I can’t get a browser with resolution 480 x 480 and less (PDAs, Handhelds, etc…) to go to the url designated in var handheld.

```auto

			// Grab the screen resolution
			var width = screen.width;
			var height = screen.height;

			// Check the screen resolution
			var handheld = width <= 480 && height <= 480 ? true : false;

			// Change the following URLs to what you like
			var handheldURL = "http://www.pdaurl.com";
			var defaultURL = "http://www.screenurl.com";

			// Check and redirect
			var gotoURL = handheld ? handheldURL : defaultURL;

			if(document.images)
				{
				window.location.replace(gotoURL);
				}
				else
				{
				window.location = gotoURL;
				}

```
