| |||||||
This is a discussion on Check Screen Resolution and Redirect within the HTML/CSS/JavaScript section, part of the Programming category; This sweet little javascript enables you to redirect a user to a specific URL depending on client machine's screen resolution. ...
![]() |
|
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
|
This sweet little javascript enables you to redirect a user to a specific URL depending on client machine's screen resolution. 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">
<script language="javascript">
if (window.screen){
var w = screen.width;
tmt_url_640 = "page_for_640_res.html";
tmt_url_800 = "page_for_800_res.html";
tmt_url_1024 = "page_for_1024_res.html";
if(w<740){
self.location.replace(tmt_url_640);
}
if(w>=740 & w<835){
self.location.replace(tmt_url_800);
}
if(w>=835){
self.location.replace(tmt_url_1024);
}
}
</script>
</html>
__________________ Would you like to Link To Us | Support TECH6 by going Premium Know more about me at Vinayaks.com | Follow TECH6 at Twitter |
|
#2
| ||||
| ||||
|
Nice Code THis is real cool but this and the OS redirect code together isnt good.
__________________ My iPhone is better than yours........... I Am Back! |
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |