Detect IE7

Discussion in 'PHP' started by DeluxeEdition, Jun 12, 2007.

  1. #1
    I've searched online but everything I find is either 3 years old or does way more than I need it to. I'm having an image issue with IE7 and I don't want to serve it if someone is using IE7.

    How would I do this:

    If Browser IE7
    ~Do Nothing
    Else
    ~Serve Image
    Endif

    Thanks for any help.
     
    DeluxeEdition, Jun 12, 2007 IP
  2. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #2
    surely you could do a pattern match against $_SERVER['HTTP_USER_AGENT']
    IE6 (on my system): Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; InfoPath.2)
    FF2 (on my system): Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4

    i only imagine that in IE7 it would be MSIE 7.0, however i could be wrong but i do not have IE7 so i cannot be 100% sure.
     
    ansi, Jun 12, 2007 IP
  3. DeluxeEdition

    DeluxeEdition Active Member

    Messages:
    308
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks ansi that's part of the problem: What do you look for to know it's IE7?
     
    DeluxeEdition, Jun 12, 2007 IP
  4. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #4
    i really couldn't tell you being as i don't have it yet. though if i may ask, what is your reason for hiding an image if it is viewed in Internet Explorer 7?

    wish i could be of more assistance
     
    ansi, Jun 12, 2007 IP
  5. DeluxeEdition

    DeluxeEdition Active Member

    Messages:
    308
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    58
    #5
    I want to hide it because of the way the site is set up (www.dennisdornon.com) one image is received if it's IE 6 and below and another if it's firefox because I'm using a transparent png. the best way to see what I'm talking about is to go to http://www.dennisdornon.com/orlando-chrysler.html in IE and Firefox and you'll see the two different images.

    IE 7 shows both images overlapping each other.
     
    DeluxeEdition, Jun 12, 2007 IP
  6. dp-user-1

    dp-user-1 Well-Known Member

    Messages:
    794
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    #6
    http://www.positioniseverything.net/articles/cc-plus.html

    Exactly what you need. Scroll down in the article for version information.
     
    dp-user-1, Jun 12, 2007 IP
  7. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #7
    That will definitely work. You can also do it with css stylesheets if it is more appropriate for your situation.

    
    <!--[if IE 7]>
    <link rel="stylesheet" ............. />
    <![endif]--> 
    
    Code (markup):
     
    jestep, Jun 12, 2007 IP
  8. DeluxeEdition

    DeluxeEdition Active Member

    Messages:
    308
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    58
    #8
    Thanks guys, I'll give it a go
     
    DeluxeEdition, Jun 12, 2007 IP