Internet Explorer Detection

This is something crucial for me, as a front end guy, designing web pages and javascript based on normal browsers (those other than Internet Explorer). When it comes to IE, I have to make sure that I have to change the JavaScript and Design altogether, as IE is another kind of species, which do not follow anything normal and have things for granted and does whatever it likes.

It has its own proprietary attributes, elements, functions, which are not standard and doesn't work across all other browsers. But other browsers are generous enough to understand that this site is done primarily keeping IE in mind and render as how IE renders.

For Eg., the element is a propreitary one of Microsoft and it has been adopted in Google Chrome, thanks to Google Developers! Some serious stuffs have been ignored, such as filter CSS attribute, which is purely proprietary to IE only! It does almost all the functions, which CSS 3 does, but it is not supported in any other browsers. But, those things, which CSS 3 can do, are supported across all the browsers but not IE!!!

Replies

  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    This made me to do something like a script to detect Internet Explorer using PHP (as almost all the apps I do are powered by PHP and it is Open Source too). The code goes this way:
    if ( eregi("MSIE"getenv"HTTP_USER_AGENT" ) ) || eregi("Internet Explorer"getenv("HTTP_USER_AGENT" ) ) ) {
      
    // do something
    }
    Okay, lets see what this script does. The function eregi() is a search function, which finds a pattern or string in another string, using Regular Expressions and returns true if it is found.

    The getenv() function is used to get the environment of the client and server system. The string HTTP_USER_AGENT is the User Agent String, which is sent by the user's browser containing the information about the browser and the operating system. Typically a User Agent string of Internet Explorer looks this way:
    Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
    So you can see that, there's information about my Browser Engine, my Operating System, and Browser Version! Here, MSIE 9.0 is my browser, which is Internet Explorer 9.0. I am using Windows 7, which is Windows NT 6.1. IE has a Trident rendering engine, which is of version 5.0! The script finds out if there's a string MSIE or Internet Explorer in the User Agent String and makes decisions based on it.
  • [Prototype]
    [Prototype]
    You can as well use the #-Link-Snipped-# feature of php. However it requires browscap.ini which is not bundled with php by default.
  • PraveenKumar Purushothaman
    PraveenKumar Purushothaman
    [Prototype]
    You can as well use the #-Link-Snipped-# feature of php. However it requires browscap.ini which is not bundled with php by default.
    Yup, now there are more and more plugins available, but the problem is we need to make sure that it is updated often... 😀

You are reading an archived discussion.

Related Posts

i am facing a problem while installing linux red hat enterprise in to my laptop,my laptop has core i5,the problem is that i have empty f:/ drive in my laptop...
All these days we were using the standard fonts in our web pages, and it takes up only those fonts which are already available in our system. But now, we...
Hi this is SAGAR PANDA studying in final year of B.E(TRADE-Computer Engineering) from Pune University.My current location is Pune. *Hobbies & Interests: Writing,surfing intrnet. *Aim in life: (if applicable 😁...
where should i put database(mysql) on webspace(server) and how to launch wesite created in jsp tec
Introduction This is a big issue in many of the Websites. First lets see what is FOUC! The style part of a website is given by CSS. It contains all...