Javascript:1024 X 768 Screen Resolution

Status
Not open for further replies.

emailaatif786

Always Questioning?
My Webpage loads contents, images, animations, etc, correctly, only if user has 1024 X 768 or above Screen Resolution. But if user has below 1024x786 screen resolution, the page looks pretty horrible
Can anyone reply me with a javascript, that I will include with my webpage, that will redirect user to another page, if his screen resolution is below 1024 X 768 Screen Resolution, as just in the case of Yahoo! Mail Beta.
__________
Example:
Just head to *login.yahoo.com/config/login_verify2?&.src=ym an enter your username and password > *aa.f584.mail.yahoo.com/dc/launch?.rand=3h46eghs9tygh3

If you are having the screen resolution below 1024 X 768, you will be redirected to *aa.f584.mail.yahoo.com/dc/system_requirements?resolution=unsupported , telling you that; Seems your screen resolution is set below our minimum recommendation. When it's set under 1024 x 768 pixels, Yahoo! Mail Beta looks pretty horrible.

Please reply with the javascript, the will do this work.
 
Last edited:

mod-the-pc

Back to School Mr. Bean !
This should accomplish that

Code:
<html>
<head>
<script language="Javascript">
function checkResolution()
{
 var minWidth=1024, minHeight=768;
 var width=screen.width;
 var height=screen.height;
 var alertMsg='';
 var lowResURL='*www.team-mediaportal.com';
 if(width<minWidth && height<minHeight)
 {
  alertMsg+='Your current resoultion is '+width+'x'+height;
  alertMsg+='\nThis site requires a minimum resolution of '+minWidth+'x'+minHeight;
  alertMsg+='\nPlease click on OK to visit a low resolution version of this site';
  alert(alertMsg);
  window.location=lowResURL;
 }
 
}
</script>
</head>
<body onLoad="checkResolution()">
</body>
</html>

If you want it to be transparent to the users just remove the alert !:)
 
OP
emailaatif786

emailaatif786

Always Questioning?
Very Very much Thanks for replying, but I would like to change the:
var lowResURL='*www.team-mediaportal.com';
TO:
var lowResURL='rdr\errors\scres\';
which gives me an error, Object expcted.
How to resolve this!
 

anilmail17

Journeyman
emailaatif786 said:
Very Very much Thanks for replying, but I would like to change the:
var lowResURL='*www.team-mediaportal.com';
TO:
var lowResURL='rdr\errors\scres\';
which gives me an error, Object expcted.
How to resolve this!
the problem is this that u have used escape character. simply use this
Code:
var lowResURL='rdr/errors/scres/';
and it will work finee.
 
Status
Not open for further replies.
Top Bottom