budimir Posted July 25, 2008 Share Posted July 25, 2008 Hey guys, Why isn't this script working? It's a script for redirecting to antoher file depending on the resoultion. But when I load a file it just does nothing. <SCRIPT language="JavaScript"> <!-- if ((screen.width >= 1024) && (screen.height >= 768)) { window.location="index.php"; } else { window.location="index_glavni_m.php"; } //--> </SCRIPT> Help, please!!!!! Quote Link to comment Share on other sites More sharing options...
proggR Posted July 25, 2008 Share Posted July 25, 2008 What is the name of the file that has this script? index.html? And are those files in the same directory as this file? Do either of them load? Quote Link to comment Share on other sites More sharing options...
budimir Posted July 25, 2008 Author Share Posted July 25, 2008 The files a re in the same dir. I think the problem is that it can't load the file in which is this script. The file name that has the script is index.php! Quote Link to comment Share on other sites More sharing options...
proggR Posted July 25, 2008 Share Posted July 25, 2008 Scratch that. I tried it on this end by substituting google into the first and phpfreaks into the second and it was the same thing. It wouldn't even redirect without the if statements though. Not sure. JS is enabled here so I'm not sure. The syntax is right as far as i know. *edit* does that mean if they have a large screen size it recursively calls itself? The page loads, runs the script, redirects to the page, runs the script.... Quote Link to comment Share on other sites More sharing options...
budimir Posted July 25, 2008 Author Share Posted July 25, 2008 OK, I think I get where is the problem. The script can't be in the same file from which I'm calling the redirect. I need to take it to another file, than it's working. So, it would be. Index.php -> resolution.php -> index_h.php or index_l.php Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.