I have a redirect script that i got from the internet written by fjhdehoog which i need slightly adjusting but i do not know how to.
Here is the script.
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">
<head>
<title>My Web Page</title>
<script type="text/javascript">
<!-- Begin
/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: fjhdehoog :: http://members.home.nl/fjhdehoog */
var thiswidth=screen.width;
var thisheight=screen.height;
// file to load if resolution is 640x480:
var if640x480 ="index640x480.html";
// file to load if resolution is 800x600:
var if800x600="index_800x600.html";
// file to load if resolution is 1024x768:
var if1024x768="index_1024x768.html";
// file to load if resolution is 1152x864:
var if1152x864="index_1152x864.html";
// file to load if resolution is 1280x720:
var if1280x1024="index_1152x864.html";
// file to load if resolution is greater than 1280x720:
var Redirect ="http://www.google.co.uk";
var msg="Sorry my page cannot be viewed with current resolution.\nCurrent Resolution : "+ thiswidth +' x '+thisheight+"\nTip Set your resolution to 800 x 600.\nRedirecting to google.com";
location=(Redirect);
// Do not change anything below this line
// --------------------------------------
var width1 = 640; var height1 = 480;
var width2 = 800; var height2 = 600;
var width3 = 1024; var height3 = 768;
var width4 = 1152; var height4 = 864;
var width5 = 1280; var height5 = 1024;
if (screen.width == width1 || screen.height == height1){
alert(msg);}
else if(screen.width == width2 || screen.height == height2){
location=(if800x600);}
else if(screen.width == width3 || screen.height == height3){
location=(if1024x768);}
else if(screen.width == width4 || screen.height == height4){
location=(if1152x864);}
else if(screen.width == width5 || screen.height == height5){
location=(if1280x1024);}
else if(screen.width >= width5 || screen.height >= height5){
alert(msg);
}
//-->
</script>
<!-- Script Size: 2.05 KB -->
</head>
<body>
</body>
</html>
I know the code is pretty self explainitary but i couldnt adjust it as required.
What i need to do is:
1: If resolution <= 600x800 then direct to "index_800x600.html"
2: If resolution > 600x800 and < 1152x864 then direct to "index_1024x768
.html"
3: If resolution >1152x864 then direct to "index_1152x864
.html"
Please advise as when i tried what i thought (it never worked !!)
I'm hoping it is fairly easy as i am keen to integrate this into my website.
TIA