Detecting IE8 reliably using javascript?

Won't detect Opera-spoofing unfortunately... – Rushyo Aug 31 '10 at 13:09 i'm not sure if that works for a browser running in compatibility mode. Have you tested it? – geowa4 Aug 31 '10 at 13:10 @Rushyo: I think that's just what you want: Opera presenting itself as IE is still Opera and acts like Opera.

– Marcel Korpel Aug 31 '10 at 14:24 Depends. To override a user's intent is typically a bad thing(tm). Then again, the user is an idiot for relying on spoofing.

– Rushyo Aug 31 '10 at 14:37 @Rushyo: But Opera only put spoofing in Opera to let users use sites that rely on (bad) browser sniffing, so they can use sites that otherwise would be inaccessible (that's also why this is a per-site setting). – Marcel Korpel Sep 1 '10 at 11:18.

The user agent is not a sensible or reliable way of determining the browser version. Why don't you look for the presence of the feature you require by making it IE8 only and use that? That is a much more reliable method.

modernizr.com/ It should detect such issues. Alternatively, I'm not sure but IE 8 might switch its User-Agent tag in 'Compatibility Mode'.

UA sniffing is even worse than version detection in JS - see Chrome's UA for a taste of the insanity: User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2 (some braindead scripts are looking for "Gecko" in the script, because that's what Firefox has; and don't get me started on the initial "Mozilla") – Piskvor Aug 31 '10 at 13:09 Modernizr detects features, not bugs, incompatibility or browser versions – Yi Jiang Aug 31 '10 at 13:10 @Yi Jiang: ah ok, I must have misunderstood. I was reacting to the part about User-agent. – Piskvor Aug 31 '10 at 13:11 @Piskvor And I was responding to the original poster of this answer... Your comment didn't showed up when I was typing the comment.... clarified.

– Yi Jiang Aug 31 '10 at 13:14 @Yi Jiang: Which is often (usually? ) the legitimate intent of people asking questions about user agent sniffing. @Piskvor: I wasn't advocating anything, just responding to the question.

He wanted to see what was weird with his scenario - I suspect it might have been that. – Rushyo Aug 31 '10 at 14:36.

The most entertaining trick I've seen — without having any idea of how efficient it is — is to leverage the IE conditional comment feature dynamically. To do that, your code takes a hidden or a in a document fragment, or whatever, and inserts into it some HTML surrounded by a conditional comment coded to check for a specific browser version: var dummy = document. GetElementById('dummy'); dummy.

InnerHTML = 'x'; var isIE8 = dummy. InnerHTML === 'x'; IE8 can show a little button next to the URL box that switches the browser between IE7 mode and IE8 mode. You can open up the "Developer Tools" and that'll tell you what the current setting is.

That's very much like gist.github. Com/527683, gist.github. Com/542301 and gist.github.Com/548648 – Marcel Korpel Aug 31 '10 at 14:27 yes I didn't make it up; I'm not smart enough for that :-) – Pointy Aug 31 '10 at 15:45.

The only way I can figure out how to get my version of IE8 to say that it is IE7 is to enable Compatibility View. See blogs.msdn.com/b/ie/archive/2008/08/27/i....

Turns out his browser was set to display all 'intranet sites' in compatibility mode. Also, yes, compatibility mode changes the user agent string.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions