resolution detection

liunx

Guest
hi,<br />
<br />
is there a way that the resolution of a users browser can be detected so that they can be redirected to the correct resolution site. for example, if i had a site at 800x600 and 1024x768 - would it be possible for someone trying to access the site to be redirected (without their knowledge) to the site that matches their screen resolution?<br />
<br />
chris.<!--content-->plenty out here, did you try searching first?<br />
<br />
<!-- m --><a class="postlink" href="http://www.a1javascripts.com/redirection_scripts/">http://www.a1javascripts.com/redirection_scripts/</a><!-- m --><br />
<br />
<!-- m --><a class="postlink" href="http://www.snippetlibrary.com/viewhtml.php?id=5&kid=56&siteid=24">http://www.snippetlibrary.com/viewhtml. ... &siteid=24</a><!-- m --><!--content-->it won't be EXACTLY without their knowledge, since redirecting them will necessarily use a different URL. however, you could always put that page in a single frame to hide the URL.<br />
<br />
a better solution might be to simply replace your CSS file with the resolution-sniffing script, using the document.write command,<br />
<br />
e.g.,<br />
<SCRIPT LANGUAGE="JavaScript"><br />
<!-- Begin rez sniff<br />
var ScrnSize = "UnCommon"<br />
<br />
if (navigator.appVersion.indexOf("4.") != -1 && <br />
navigator.appName.indexOf("Explorer") != -1) {<br />
ScrnSize = screen.width + "x" + screen.height;<br />
}<br />
if (navigator.appVersion.indexOf("4.") != -1 && <br />
navigator.appName.indexOf("Netscape") != -1) {<br />
ScrnSize = screen.width + "x" + (screen.height + 19); //Netscape sees 19 pixels less on Height<br />
}<br />
switch(ScrnSize) {<br />
case "640x480": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"640.css">');<br />
case "800x600": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"800.css">');<br />
case "1024x768": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"1024.css">');<br />
case "1152x864": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"1152.css">');<br />
case "1280x1024": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"1280.css">');<br />
case "1600x1200": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"1600.css">');<br />
case "1600x1280": document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"1600_.css">');<br />
default: document.write('<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"800.css">');<br />
}<br />
<br />
// End rez sniff --><br />
</script><!--content-->
 
Back
Top