Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer redirect basec on browser

    i need a php script that will redirect all IE users to a specified url and all other browsers to a different url

    thanks in advance

    **its redirect based on browser**sorry!
    Last edited by HTML_Kid; 02-05-2007 at 03:33 AM.
    $must = $_GET['life'];

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    Can't be done in PHP because the PHP runs on the server and the only info passed to the server as to what browser it is comes via the useragent and all browsers claim to be Internet Explorer in that field (at least part of the time).

    You could use HTML.

    <!--[if IE]>
    IE specific code goes here, all other browsers will treat is as a comment
    <[endif]-->
    <!--[if !IE]-->
    code for other browsers goes here
    <!--[endif]-->
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    I found this on the internet (see attached file).
    It seems to work for me. Detach it and change the
    extension to .php Then upload into the same directory
    as your PHP script.

    Play around with it and see what you find.

    This is the part in your PHP script that utilizes "browser.php":
    PHP Code:
    <?php
    require_once('browser.php');
    $br = new Browser;
    echo 
    "$br->Platform, $br->Name version $br->Version";
    ?>
    Attached Files Attached Files

  • #4
    New Coder
    Join Date
    Feb 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you for that , but how do i get it to send the user to a page for ie and a different page for everything eylse
    $must = $_GET['life'];

  • #5
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,538
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    something like this ....

    PHP Code:
    <?php
    require_once('browser.php');
            
    $br = new Browser;
            
    //echo "$br->Platform, $br->Name version $br->Version";
    if($br->Name === "MSIE"){
    header ("location: my_ie_page.php");
    }
    elseif(
    $br->Name === "Firefox"){
    header ("location: my_firefox_page.php");
    }
    else{
    header ("location: default.php");
    }

    ?>
    Last edited by mlseim; 02-05-2007 at 03:45 AM.

  • #6
    New Coder
    Join Date
    Feb 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thank you it works great
    $must = $_GET['life'];


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •