Welcome visitor
* Login
* Register
It is currently September 19th, 2019, 4:43 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  Find client browser resolution
PostPosted: October 5th, 2009, 5:23 pm 

Posts: 39
I've heard that you can find the screen resolution of the client computer, if this is true can you please show me how to do it? Thanks guys and gals.


Top
 Profile  
 
  Re: find user resolution
PostPosted: October 5th, 2009, 6:00 pm 
Site Admin
User avatar

Posts: 39
You can do it by using JavaScript.

The following function redirects to a new page according to the client's resolution.

<script language="JavaScript">

function resolutionRedirect(){
  if (screen.width == 640){
      window.location.href=  "http://www.mysite.com/small.html";
      }
  else if (screen.width == 800){
      window.location.href= "http://www.mysite.com/medium.html";
      }
  else if (screen.width == 1024){
      window.location.href= "http://www.mysite.com/big.html";
      }
  else {
      window.location.href= "http://www.mysite.com/others.html";
      }
}
</script>

<body onLoad="resolutionRedirect();">




Play with different values according to today's most common screen resolutions.

REGARDS

_________________
I'm not afraid to die. I just don't want to be there when it happens.
- Woody Allen


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron