Machine

Welcome to MSDN Blogs Sign in | Join | Help
Show IE version-specific content sample

This page detects your Internet Explorer version via navigator.userAgent and then hides the content that does not apply to your version. When parsing the userAgent, it looks for "MSIE 5", "MSIE 6", "MSIE 7", or "Trident 4" (Trident 4 is IE8, which sends "MSIE 8" in Standards mode and "MSIE 7" in Compatibility Mode). This page using inline JavaScript. The sample (attached) includes .js files and a separate content .htm file. Thanks to Jeremy for providing the sample and helping me tweak it to work with IE8.

The results of the detection are displayed below:

We identified that you are using:
Browser: Internet Explorer 5
We identified that you are using:
Browser: Internet Explorer 6
We identified that you are using:
Browser: Internet Explorer 7
We identified that you are using:
Browser: Internet Explorer 8
We could not identify your browser version:
Browser: Unknown
Posted: Sunday, March 01, 2009 3:30 AM by WilliamK
Filed under:

Attachment(s): pcTemplatePageScripts.zip

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker