#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    9
    Rep Power
    0
    hi, i recently found out my site doesn't work for Linux netscape and a few other non-popular browsers.

    so I decided to try and make a script that would redirect the people depending on their browser...

    I stick this inside the href tag like this:

    <a href="<?php
    if ($BROWSER == "MSIE") { echo "site/"; }
    if ($BROWSER == "Netscape") { echo "site/"; }
    else { echo "site/text-only/"; }
    ?>">enter</a>

    what am I doing wrong? btw...I don't have any real programming experience - just trying to do it off the top of my head and from articles.

    Thanks

    - ghost

    ------------------
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    your script just prints out links , you need to tell the browser to execute them - ie:
    if (etc etc ......
    <?php echo "<script>window.location.href= "thisdir.html"</script>";?>

    etc

    Regards



    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    fp is right that you can't just print out the links, but using JS to solve the problem isn't a solution as a lot of the browsers you're having problems with won't support that. Use the PHP header() function to do a redirect:

    if ($condition==$good_browser)
    {
    header("Location: site/");
    exit;
    }
    header("location: site/text-only/");
    exit
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Posts
    9
    Rep Power
    0
    Well, what I am looking for is not a direct "redirection"...
    instead, I have a button that they must click to select the specific site they want to go to... and I only need the browser specific stuff for that one button link. There are multiple sites to go to (this page is sort of like a Table of Contents)... and only one site needs the browser specific stuff.

    I also need to know the variable names for the Different browsers. I need both IE and Netscape names.

    Seeing how this is a preprocessor language, I think that the page should be able to detect the browser...and upon the detection, change the URL that the specific button will go to.

    (sorry if this sounds confusing)

    Thanks

    - ghost

    ------------------

Similar Threads

  1. .htaccess redirection with PHP variable
    By Avantasia in forum PHP Development
    Replies: 4
    Last Post: January 29th, 2004, 04:21 PM
  2. PHP and a href DOM
    By creamcheesehero in forum PHP Development
    Replies: 3
    Last Post: January 29th, 2004, 12:12 AM
  3. PHP with UnixODBC
    By coder4hire in forum PHP Development
    Replies: 2
    Last Post: January 20th, 2004, 02:14 PM
  4. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 02:41 PM
  5. PHP error redirection
    By DJWard in forum PHP Development
    Replies: 5
    Last Post: January 3rd, 2004, 02:46 PM

IMN logo majestic logo threadwatch logo seochat tools logo