Current Article
Industry Buzz
Social Networking
Featured Articles
Browse Content >
Back to Home

Detecting Internet Explorer 6

Bill Konrad
We all wish that IE6 would be abandoned by the masses, but many users have yet to upgrade to IE7. IE6 'hacks' have sprung up to deal with many of the issues plaguing developers. But how do we know that we are dealing with IE6 in the first place?

Introduction

Even hearing the name "Internet Explorer 6" can make the most seasoned web developer cringe. While its prominence has steadily dropped since the introduction of IE7, it still holds approximately 25% of the browser market. And this means that for the time being, we are stuck supporting its quirky behaviour. Fortunately, while we can not avoid IE6 entirely, we can detect its presence both on the client side using JavaScript, and in our server side code using the .NET framework class HttpBrowserCapabilities.

Market Share by Browser (September 2008)

Internet Explorer 7 26.3%
Internet Explorer 6 22.3%
Firefox 42.6%
Google Chrome 3.1%
Safari 2.7%
Opera 2.0%

Yes, we do realize this does not perfectly add up to 100%. The rest are negligable components.

What Is Being Done

There are strong initiatives to drop support for IE6 completely, including sites that give you scripts to nag your users to upgrade. While we wouldn't recommend going this far, if your site simply can't function properly for an IE6 user, it might make sense to politely inform them that they must upgrade before reaching your service.

Example

Internet Explorer 6 is no longer supported by this website. Please upgrade your web browser to Internet Explorer 7 to experience the full capabilities of our offerings. We apologize for any inconvenience this may have caused you.

What You Can Do For Now

While IE6 will continue to lose market share, while it survives we must deal with its intracacies to provide the best user experience we can.

There are two approaches we will address. The first is on the client side using JavaScript.

MSDN suggest the following approach.

Client Side Solution

function getInternetExplorerVersion()
{
    var rv = -1;

    if (navigator.appName == 'Microsoft Internet Explorer')
    {
        var ua = navigator.userAgent;
        var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
        if (re.exec(ua) != null)
            rv = parseFloat( RegExp.$1 );
    }

    return rv;

}

function checkVersion()
{

    var msg = "You're not using Internet Explorer.";
    var ver = getInternetExplorerVersion();

    if ( ver > -1 )
    {
        if ( ver >= 7.0 ) 
        msg = "You're using a recent copy of Internet Explorer."
    else
      msg = "You should upgrade your copy of Internet Explorer.";
    }

    alert( msg );

}

There are two parts to this implementation of version detection.

The first function, getInternetExplorerVersion returns a floating point value that corresponds to the version of IE. For example, getInternetExplorer might return 5.0, 6.0, 7.0, etc.

To take advantage of this function, checkVersion compares this value to 7.0, which corresponds to IE7. If you are interested in continuing to support IE6, but denying IE5 users, change this value to 6.0.

So, that was the client side solution. Now let's look at its server side counterpart.

Server Side Solution

private float getInternetExplorerVersion()
{
  
    float rv = -1;
    System.Web.HttpBrowserCapabilities browser = Request.Browser;
    if (browser.Browser == "IE")
    rv = (float)(browser.MajorVersion + browser.MinorVersion);

    return rv;
}

This function takes advantage of the .NET class HttpBrowserCapabilities, which provides various details about the capabilities of the current browser.

A full list of HttpBrowserCapabilities member variables can be found HERE.

Why Is This Useful

One useful implementation of this technique pertains to IE6's lack of native support for transparent PNGs. If we have an image that currently points to a transparent PNG, then IE6 users will not see what we expect them to. However, if we have a standard PNG (without alpha transparency) waiting in the wings, we can swap it in at runtime based on detecting their browser version.

Swap Image for IE6 Only

private void Page_Load(object sender, System.EventArgs e)
{

    double ver = getInternetExplorerVersion();

    if (ver > 0.0)
    {
        if (ver < 7.0)
        PNGImage.ImageUrl = "notransparency.png";
    } 

}

While this example is simple, it underscores the point that we can provide a varying experience to our users depending on their browser capabilities.

We hope that this tutorial has given you the confidence to gracefully deprecate your cutting edge technology for IE6 users, and leave it in tact for the rest of us!

Share Article

User Comments

Gravatar
Michael J
1/16/2009
Thanks for this little tip!
Gravatar
tema
10/4/2009
nice =)
Gravatar
Oakley Outlet
8/28/2015
Hello!
Louis Vuitton Outlet Online: http://www.louisvuittonoutletonline.us.com/
Oakley Outlet,Oakley Sunglasses: http://www.oakley-outlet.us.com/
Coach Outlet,Coach Factory Outlet: http://www.coachoutletstore.us.com/
Coach Factory Outlet: http://www.coachoutlet-factoryonline.us.com/
Coach Outlet,Coach Factory Outlet: http://www.outletcoach.us.com/
Michael Kors Outlet: http://www.michaelkorsoutletonlines.us.com/
Michael Kors Outlet Online: http://www.michaelkorsoutletinc.us.com/
Michael Kors: http://www.michael-kors-outletonline.us.com/
Michael Kors Outlet: http://www.michaelkorsfactoryoutletonline.us.com/
Oakley Sunglasses,Oakley Vault Outlet: http://www.oakleysunglassesinc.us.com/
True Religion Outlet: http://www.truereligionoutlets.us.com/
Marc By Marc Jacobs: http://www.marcsbymarcjacobs.com/
Marc Jacobs Outlet: http://www.marc-jacobsoutlet.com/
Coach Factory outlet: http://www.coachfactory-outletstores.us.com/
Coach Outlet Stores: http://www.officialcoachoutletstores.com/
Sac Longchamp: http://www.sacportefeuillepascher.com/
Coach Outlet: http://www.coachoutletfactoryonline.us.com/
Michael Kors: http://www.michaelkorsfactorystore.us.com/
The North Face Outlet: http://www.outletnorthface.us.com/
coach handbags outlet: http://www.coachbagsoutlet.us.com/
Coach Outlet Store Online: http://www.coachonlinestore.us.com/
Ray Ban Pas Cher: http://www.raybanspascher.com/
porte monnaie chanel: http://www.portemonnaiechanel.com/
sac chanel blanc: http://www.sacblanc.com/
Ray Ban Sunglasses Outlet: http://www.raybanoutletsunglasses.us.com/
Ray Ban Sunglasses: http://www.raybanaviatorsunglasses.com/
portefeuille femme chanel: http://www.femmeportefeuille.com/
portefeuille chanel femme: http://www.portefeuillesfemme.com/
Cheap Ray Ban Sunglasses 90% off: http://www.raybansunglasses90off.com/
Ray Ban Sunglasses outlet,ray ban: http://www.sunglassesoff.com/
Chi Flat Iron,Chi Hair Official Website: http://www.chiofficialwebsite.com/
Coach Outlet: http://www.onlinecoachoutlet.us.com/
Toms Shoes,Toms Shoes Outlet Online: http://www.tomsshoe.us.com/
True Religion Outlet: http://www.truereligionoutletstores.us.com/
Oakley Outlet Store Online: http://www.oakleyoutletstoresonline.com/
Oakley Outlet: http://www.oakleyoutletstoreonline.us.com/
Bracelet hermes,sac chanel: http://www.sacportefeuilles.com/
Sac Chanel: http://www.portefeuillepascher.com/
Burberry Outlet Online: http://www.outletonlineburberry.com/
Oakley Sunglasses 90% off: http://www.oakleysunglasses90off.com/
Chanel Porte Monnaie: http://www.chanelportemonnaie.com/
Chanel Porte Monnaie Pas cher: http://www.portemonnaiepascher.com/
Valentino Rockstud shoes: http://www.valentino.com.co/
valentino shoes: http://www.valentinoshoes.com.co/
cheap coach handbags: http://www.cheapcoachhandbags.us.com/
Coach Outlet Stores Online: http://www.coach-outletstoresonline.us.com/
Coach Factory outlet: http://www.coachoutlet-factorystore.us.com/
Oakley Sunglasses Outlet: http://www.oakleyoutletsunglasses.us.com/
Oakley Sunglasses outlet: http://www.sunglassesoutletoff.com/
Tiffany And Co: http://www.tiffanyoutletstore.us.com/
Michael Kors Outlet: http://www.michaelkorssoutlet.us.com/
Coach Factory: http://www.coachoutletfactorystoresonline.com/
Christian Louboutin: http://www.christianlouboutins.us.com/
Valentino Shoes On Sale: http://www.valentinoshoeswebsite.com/
Christian Louboutin: http://www.christian-louboutinshoes.us.com/
Christian Louboutin: http://www.christianlouboutinshoesoutlet.us.com/
Beats Headphones Black Friday: http://www.beatsbydrdreheadphone.us.com/
Beats By Dre: http://www.beatsbydrdre.com.co/
Michael Kors Outlet: http://www.michael-korsoutlet.com.co/
Michael Kors Outlet Online: http://www.michaelkorsoutletonlineeco.us.com/
Tiffany And Co outlet 2015: http://www.tiffanyandco2015.com/
Tiffany And Co: http://www.coandtiffany.us.com/
Michael Kors handbags outlet: http://www.michaelkorshandbagsoutlet.us.com/
Beats By Dre headphones: http://www.beatsbydreheadphone.us.com/
cheap hair straighteners: http://www.cheaphairstraighteners.us.com/
Christian Louboutin shoes: http://www.christianlouboutinshoes.com.co/
Christian Louboutin: http://www.christian-louboutin.com.co/
lunettes ray ban: http://www.lunettesofficiel.com/
Coach Factory Outlet: http://www.coachoutletfactorystores.us.com/
Coach Outlet Online: http://www.coachoutletonlinesale.us.com/
Michael Kors Outlet: http://www.michaelkorsoutletonlinein.com/
Michael Kors Outlet: http://www.michaelkors-factoryoutlet.us.com/
Michael Kors Outlet Online: http://www.onlinemichaelkorsoutlet.us.com/
Oakley Sunglasses outlet: http://www.oakleysunglassesoutletonline.us.com/
True Religion Jeans outlet: http://www.true-religionjeans.com.co/
True Religion Jeans: http://www.truereligionoutletco.us.com/
Oakley Sunglasses: http://www.oakleycheapsunglasses.us.com/
Cheap Oakley Outlet: http://www.cheapoakleyoutlet.us.com/
Coach Outlet,Coach Handbags: http://www.coachoutletstores.us.org/
True Religion Jeans: http://www.truereligions.us.com/
ray-ban sunglasses,ray ban: http://www.ray-bansunglasses.it/
Oakley Sunglasses: http://www.oakleysunglasses.com.im/
Coach Outlet Store Online: http://www.coachonlinestoresoutlet.com/
Coach Outlet Online: http://www.coachoutletonlinecoachfactory.com/
Red Bottom Shoes: http://www.redbottomshoes.com.co/
Michael Kors Outlet: http://www.michaelkorsoutletco.us.com/
Toms Shoes Outlet Online: http://www.tomsshoeoutletonline.com/
True Religion Jeans: http://www.truereligionfactoryoutlet.us.com/
True Religion Outlet,True Religion: http://www.truereligionoutlet.us.org/
Ray-Ban Aviator Sunglasses: http://www.raybanaviatorsunglasses.com/
Ray Ban Outlet: http://www.raybanoutlet.us.com/
Ray-Ban Sunglasses: http://www.ray-bansunglasses.us.com/
Red Bottom Shoes,Red Bottom: http://www.redbottomshoe.us.com/
Tiffany And Co Jewelry: http://www.tiffanyandco.us.com/
Tiffany Outlet: http://www.tiffanyoutlet.com.co/
Tiffany And Co: http://www.andcotiffany.us.com/
Tiffany And Co jewelry outlet: http://www.tiffany.us.org/
valentino shoes On Sale: http://www.valentinoshoesonsale.com/
valentino outlet: http://www.valentinooutletshoes.com/
mocassin sac chanel: http://www.sacenpaille.com/
lunettes vue ray ban: http://www.raybanofficiel.com/
ray ban pas cher: http://www.lunettesdevue2015.com/
Beats By Dr Dre,Headphones: http://www.beatsbydrdre.us.com/
Red Bottom Shoes for women: http://www.red-bottomshoes.us.com/
Tiffany And Co,Tiffany Outlet: http://www.tiffanyandco.us.org/
Tiffany And Co jewelry: http://www.tiffanyandcojewelry.us.com/
Ray Ban Outlet: http://www.ray-banoutlet.us.com/
Chi Flat Iron: http://www.chiflatiron.org/
Chi Flat Iron official website: http://www.chiflatironblackfriday.com/
Ray Ban Sunglasses: http://www.raybansunglassess.us.com/
Cheap Ray Ban Sunglasses: http://www.cheapraybansunglasses.com.co/
True Religion Jeans On Sale: http://www.truereligion-jeans.us.com/
True Religion Jeans: http://www.true-religionjeans.us.com/
Christian Louboutin Heels: http://www.christianlouboutinheels.com/
Model De Sac Chanel: http://www.modeldesac.com/
Model De Sac Chanel pas cher: http://www.modeldesacpascher.com/
Christian Louboutin: http://www.christianlouboutinco.us.com/
Christian Louboutin shoes Outlet Online: http://www.clshoesoutletonline.com/
Beats By Dre Black Friday: http://www.beatsbydreblackfriday.us.com/
Cheap Beats By Dre: http://www.cheapbeatsbydre.us.com/
Cheap Ray Ban Sunglasses: http://www.raybancheapsunglasses.us.com/
Ray Ban Outlet Store: http://www.raybanoutletstore.com/
Toms Shoes Outlet Online: http://www.tomsoutlet.us.com/
Louboutin shoes: http://www.louboutinshoes.com.co/
Louboutin Outlet: http://www.louboutinoutlet.com.co/
Hermes Belt,Hermes Outlet: http://www.hermesbeltsoutlet.com/
Hermes Bag,Hermes Handbags: http://www.hermesbag.us.com/
Gucci Handbags,Gucci Shoes,Gucci: http://www.guccishoesoutletonline.com/
Christian Louboutin shoes: http://www.louboutin.us.com/
Cheap Nike Air Max: http://www.cheapnikeairmaxes.com/
Coach Outlet Store Online: http://www.coachoutlet-storeonline.com/
Chanel Handbags,Chanel Purses: http://www.chanelhandbagswebsite.com/
Chi Flat Irons: http://www.chiflatirons.com.co/
Toms Shoes Outlet Online: http://www.tomsshoesoutletonlines.com/
Coach Outlet,Coach: http://www.coach-factory-outletonline.us.com/
Ray Ban Wayfarer Sunglasses: http://www.raybanwayfarersunglasses.com/
Sac Chanel Blanc Pascher: http://www.sacblancpascher.com/
Sac Chanel Vuir Blanc: http://www.sacsblanc.com/
Coach Factory Outlet Online: http://www.factorystoreonline.com/
Coach Purses Outlet: http://www.coachpursesoutlet.us.com/
Michael Kors: http://www.onlinemichaelkors.us.com/
Michael Kors Outlet: http://www.michaelkorsstoreoutlet.us.com/
Beats By Dre Headphones: http://www.beatsbydreheadphones.com.co/
Gucci Outlet,Gucci Handbags: http://www.outletgucci.us.com/
Coach Outlet: http://www.coach-outlet-online.us.com/
Valentino Shoes,Valentino: http://www.valentinoshoes.us.org/
Louis Vuitton Outlet: http://www.louisvuitton-outletsale.com/
Louis Vuitton: http://www.louisvuitton.us.org/
Michael Kors purses outlet: http://www.michaelkorspursesoutlet.us.com/
Michael Kors Handbags: http://www.michaelkorshandbags.us.com/
Louis Vuitton Outlet: http://www.louisvuittonoutlet-store.com/
Louis Vuitton Outlet: http://www.louis-vuitton-outlet-online.com/
Louis Vuitton Outlet Online: http://www.louisvuittonoutlet-online.com/
Valentino Sandals: http://www.valentinosandals.com/
Valentino Rockstud: http://www.valentinorockstudshoes.com/
Louis Vuitton Outlet: http://www.louis-vuittonus.com/
Louis Vuitton Outlet Stores: http://www.outletonlinelouisvuitton.com/
Sac Louis Vuitton: http://www.saclouisvuittons.com/
Kate Spade Outlet: http://www.katespadeoutletonline.us.com/
Kate Spade outlet Online: http://www.katespadesoutlet.us.com/
Red Bottom Shoes: http://www.redbottomshoes.us.com/
Beats Headphones Black Friday: http://www.beatsheadphonesblackfriday.us.com/
Toms Shoes: http://www.tomsshoes2015sale.com/
Chi Official Website: http://www.chiflatirons.us.com/
Cheap Oakleys: http://www.cheapoakleys.us.com/
Oakley Outlet: http://www.oakleyoutlet.com.co/
Coach Outlet: http://www.coachoutletfactorystore.com/
Michael Kors: http://www.michaelkorsoutletsstore.cc/
Sac Hermes,sac hermès birkin: http://www.pascherhermes.com/
Giuseppe Zanotti: http://www.giuseppezanottishoe.com/
Chanel Handbags,CoCo Chanel: http://www.coco-chanel.us.com/
Tiffany Outlet: http://www.tiffanyoutlet.us.org/
Tiffany And Co Jewelry Outlet Online: http://www.jewelryoutlet.com.co/
Chi Flat Iron Official: http://www.chiflatironofficial.us.com/
Chi Flat Iron 2015 sale: http://www.chiflatiron2015.com/
Burberry Outlet Online: http://www.burberryoutlet-online.us.com/
True Religion Outlet Jeans: http://www.truereligionoutletjeans.us.com/
True Religion Outlet Store Online: http://www.jeansoutlet.com.co/
Chanel Handbags,Chanel Outlet: http://www.chanel-outlet.us.com/
Prada Outlet,Prada Handbags: http://www.pradaoutlet.eu.com/
Prada Handbags: http://www.pradahandbags.eu.com/
Prada Handbags Outlet: http://www.pradahandbags.us.org/
Marc By Marc Jacobs: http://www.marcbymarc-jacobs.com/
Celine Handbags: http://www.celine-handbags.com/
Celine Handbags Outlet: http://www.celinehandbags.us.com/
Valentino Wedges: http://www.valentinowedges.com/
Valentino Boots: http://www.valentinoboots.com/
Ray Ban Sunglasses: http://www.ray--bansunglasses.us.com/
Oakley Sunglasses: http://www.oakleyglasses.us.com/
Ray Ban Sunglasses: http://www.cheapraybansunglasses.us.com/
Ray Ban Sunglasses: http://www.rayban-sunglasses.us.com/
Cheap Ray Ban Sunglasses: http://www.cheaprayban.us.com/
Ray Ban Glasses: http://www.ray-bans.us.com/
Oakley Sunglasses: http://www.oakleysunglasseswebsite.com/
Cheap Oakley Sunglasses: http://www.oakleysunglassesstores.us.com/
Oakley Vault Sunglasses: http://www.oakleyvaultsunglasses.com/
Cheap Oakley Sunglasses: http://www.cheapoakleysunglasses.com.co/
Toms Outlet,Toms: http://www.tomsoutlet.in.net/
Abercrombie Outlet: http://www.abercrombieandfitchoutlets.com/
Abercrombie And Fitch: http://www.abercrombieandfitchoutlet.us.com/
Polo Ralph Lauren: http://www.polo-ralphlauren.us.com/
Ralph Lauren Outlet: http://www.ralphlaurenoutlets.us.com/
Valentino Shoes,Valentino: http://www.valentinoshoe.com/
Ray Ban Outlet,Ray Ban: http://www.raybansoutlet.us.com/
Coach Factory Outlet: http://www.coach-outletstores.us.com/
The North Face Outlet: http://www.thenorth-face.us.com/
Coach Factory Outlet: http://www.coachoutletonlinecoachfactory.us.com/
Kate Spade Handbags: http://www.katespadehandbag.us.com/
Coach Factory Outlet: http://www.coachfactory-outlet.us.org/
Coach Factory Outlet: http://www.coachfactoryoutletcoachoutletonline.com/
Coach Outlet Store Online: http://www.coachoutletstoresonline.com/
Coach Outlet,Coach Factory Outlet: http://www.outlet-coach.us.com/
Coach Factory Outlet: http://www.coachfactoryoutletonlines.us.com/
Kate Spade Outlet: http://www.katespades.us.com/
Giuseppe Zanotti: http://www.giuseppezanotti.us.com/
Sac chanel: http://www.saccuirmarron.com/
Michael Kors Outlet: http://www.outlet-michaelkors.us.com/
Ray Ban Sunglasses: http://www.raybanssunglasses.us.com/
Hollister Clothing Store: http://www.hollisteroutlet.us.com/
Abercrombie and Fitch: http://www.abercrombieoutlets.us.com/
Ralph Lauren Outlet: http://www.polosralphlauren.us.com/
Marc Jacobs handbags: http://www.jacobsmarcjacobs.com/
Marc By Marc Jacobs: http://www.marcjacobsmarcjacobs.com/
Marc Jacobs Outlet: http://www.marcjacobsoutletstores.com/
Chi Official Website: http://www.chiflatirons.us.com/

Gravatar
Ralph Lauren Outlet
9/5/2015
Ralph Lauren Items! Find the Best Value with Trusted Sellers.
http://www.official-cheapjerseys.com/ Cheap Jerseys
http://oakleysunglassesoutlet.name/ Oakley Sunglasses
http://www.ray-bansunglasses.ca/ Ray-Ban Sunglasses
http://oakleyoutletstore.net.co/ Oakley Outlet
http://nfljerseyswhosale.us.com/ nfl jerseys
http://oakleysunglassescheap.net.co/ Oakley Sunglasses Cheap
http://www.ray-bansunglasses.cc/ Ray-Ban Sunglasses
http://ray-bansunglasses.top/ Ray Ban Sunglasses
http://www.raybanoutletstoresonline.net/ Ray Ban Outlet
http://www.ralphlaurenoutletstoreonline.com/ Ralph Lauren Outlet
http://www.raybanoutletsunglasses.org/ ray ban outlet
http://poloralphlaurenoutletstore.net/ Polo Ralph Lauren Outlet
Add a Comment

Name

Email Address

1 + 1 = ?

Comment










iphone application development konrad group
android application development konrad group
windows phone 7 development konrad group