Detecting IE8 Compatibility View/Mode.

Greetings!

I'm trying to figure something out here.

I have:

<!--[if lt IE 8]>
According to the conditional comment this is Internet Explorer less than 8<br />
<![endif]-->

The problem is if IE8 is in compatibility mode/view it reports as IE7 and triggers this condition.  We're wanting to redirect anyone running IE7 or lower.

Is there anyways to determine if someone is running IE8 in compat mode and "return" it as IE8?  

I'm also trying to find a nice little script to determine if JS is enabled but that might be for a different post.  We're running Coldfusion 9 server if that helps.
gr1zAsked:
Who is Participating?
 
leakim971PluritechnicianCommented:
Off topic but check this : http://code.google.com/p/ie7-js/
0
 
jhyieslaCommented:
Not sure if this will help or not, but I wrote a little JS that I embedded into a page that checks to see the version of IE that's running.  I'll attach the code below. Ignore the actual actions within the script, but see if the identifying line of code might get you what you need.
<SCRIPT language="JavaScript">
		var bname = navigator.appVersion;
	if (bname.substring(22,23) == "7" || bname.substring(22,23) == "8")
	{
     	setTimeout("window.open('', '_self', '');window.close();",9000);
  	} 
	else 
	{
        setTimeout("window.opener = window;window.close();",9000);
   	}
		</SCRIPT>

Open in new window

0
 
gr1zAuthor Commented:
If there is a way to force our website to be viewed in IE8 Standard Mode that would work too.  I'm checking over what you guys have posted.

There is one problem in IE7 otherwise we could allow both IE7 and IE8 compatibility mode/view.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
gr1zAuthor Commented:
Actually folks... We've resolved our issue in IE8 + Compat.  IE7 is still having issues but at least we're getting there lol.
0
 
jhyieslaCommented:
Glad you got that part fixed. I don't know how to force what you want. Was just sending the script as hopefully a way to identify version being used and then you'd have to go from there.
I think the variable that's being looked at is hard-coded into IE and has nothing to do with compatibility mode.
0
 
OP_ZaharinCommented:
- see if this JavaScript helps. you just need to add the version condition to = 6, =7 to detect for each IE version:
http://blogs.msdn.com/b/giorgio/archive/2009/04/14/how-to-detect-ie8-using-javascript-client-side.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.