?
Solved

How to detect IE6 & display a special message

Posted on 2008-10-26
5
Medium Priority
?
4,091 Views
Last Modified: 2013-11-19
I need a little javascript that will detect for IE6 and then let me display a message telling them to upgrade their browser. It would be ideal to just direct them to a special page where I could explain the whole thing.

I need code I can drop into my page. If possible, this seems like a pretty good script:
http://www.quirksmode.org/js/detect.html
0
Comment
Question by:cmlawson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 12

Accepted Solution

by:
jazzIIIlove earned 1000 total points
ID: 22808451

<script type="text/javascript">
 
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){ //test for MSIE x.x;
 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
 if (ieversion>=8)
  document.write("Damn, You're using IE8 or above, use FireFox")
 else if (ieversion>=7)
  document.write("Damn, You're using IE7.x, use FireFox")
 else if (ieversion>=6)
  document.write("Damn, You're using IE6.x, use FireFox")
 else if (ieversion>=5)
  document.write("Damn, You're using IE5.x, use FireFox")
}
else
 document.write("lol")
</script>

Open in new window

0
 
LVL 2

Assisted Solution

by:quetzal22
quetzal22 earned 1000 total points
ID: 22809291
try conditional comments:
http://www.quirksmode.org/css/condcom.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">
 
<html>
<head>
<title></title>
</head>
<body>
<!-- check if browser is LESS than or EQUAL TO IE 6 -->
<!--[if lte IE 6]>
Please upgrade
<![endif]-->
</body>
</html>

Open in new window

0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 22809599
"telling them to upgrade their browser."

As funny as the comments are above, in reality, you are living in a DREAM world.  If you worked for a corporation at $80K+ per year, and they said YOU WILL USE IE6 and nothing else, or you will WALK, then I bet you wouldn't walk.  THAT is the reality of corporate choices today.  Companies for the most part do not trust anything but IE6 right now, and you damn-well WILL use it or else.  I think 80% of companies still require their employees to use IE6, or IE7 if they are "enlightened".

So save the prejudice about IE6 worse than Firefox (which I agree with, BTW) for yourself.  The choice of a user's browser is UP TO THE USER -- just like your choice of a ("running") mate.  To do browser detects correctly, you just change the code in the background per the browser, and not proselytize.
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22809699
<<To do browser detects correctly, you just change the code in the background per the browser, and <<not proselytize.

This is a nice approach...I mean it is not very wise to tell the user, upgrade it...I mean if i were a guest of such site, i would feel as if i were belittled...so, i would leave the site...Adapt your code to different browsers, so that the guests won't have problems...

Best regards...
0
 

Author Comment

by:cmlawson
ID: 22836160
scrathcyboy - don't be a douche. this is not a forum. it's a place for solutions. you wanna discuss stuff like this head on over to sitepoint or digitalforums....
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question