Jump to content

[SOLVED] Problem with resolution script!


budimir

Recommended Posts

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!!!!!

Link to comment
https://forums.phpfreaks.com/topic/116641-solved-problem-with-resolution-script/
Share on other sites

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....

 

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.