ident Posted November 25, 2009 Share Posted November 25, 2009 Basically my site is having a few bugs with how it displays IE. It works fine in FF. while i am sorting this i added a redirction page to alert the user. <?php function ae_detect_ie() { if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) return true; else return false; } ?> <?php if (ae_detect_ie()) { ?> echo "<script language='javascript'> window.location = "http://www.url.com/Ie.php" </script>"; <?php } ?> Obviously each time they hit index.php it displays this. How can i add a varible or something so it only redirects them once. than ks Quote Link to comment Share on other sites More sharing options...
HokieTracks Posted November 25, 2009 Share Posted November 25, 2009 You could set a session variable and then check to see whether or not the session variable exists. The session variable, however, will last until they exit their browser. <?php session_start(); function ae_detect_ie() { if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) return true; else return false; } ?> <?php if(is_null($_SESSION['viewed'])){ if (ae_detect_ie()) { ?> echo "<script language='javascript'> window.location = "http://www.url.com/Ie.php" </script>"; <?php $_SESSION['viewed'] = 1; } } ?> Quote Link to comment Share on other sites More sharing options...
ident Posted November 25, 2009 Author Share Posted November 25, 2009 Your code still loads the redirect page 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.