0

I've recently discovered that you can use this to detect Windows versions:

<!--[if WindowsEdition]>Blah<![endif]-->

But what values does WindowsEdition use?

Basically I'm trying to use a conditional comment to detect if users of Internet Explorer are on a Windows version that would support an upgrade to IE9 or above. I'd like to be able to detect the difference between "Windows XP and below" and "Windows Vista and higher".

The purpose of this is to direct users of IE7 and below to either an update to IE9/10, or a switch to Chrome/Firefox if their OS doesn't support IE9. The reason for doing this is that the site works in IE8, but lacks many CSS features so it is, in a few words, "ugly but usable".

7
  • I think Windows itself already does this (the IE forced upgrade). Any Windows version that doesn't support IE9 also doesn't support Chrome, if I'm not mistaken. I honestly wonder how many people actually install new browsers just because a single website is a little ugly (unless it's something they use heavily, like Gmail/Facebook or something). Commented Dec 8, 2012 at 2:03
  • Maybe this help: stackoverflow.com/questions/4006420/… Commented Dec 8, 2012 at 2:11
  • @WesleyMurch, windows xp doesn't support IE9 but supports Chrome. Commented Dec 8, 2012 at 2:18
  • Like @WesleyMurch said, a few people upgrade their browser only for a single site if they are not using it heavily so I think you can just disallow the users who have not a modern browser to view your site properly and inform them to upgrade their browser. I did once same thing for one of my site because I didn't want my site to be ugly for lacks of css3 or such things. Commented Dec 8, 2012 at 2:25
  • Sounds like you really could do that with Javascript. Commented Dec 8, 2012 at 2:49

1 Answer 1

1

Only versions of Windows Vista or newer will return a value to the WindowEdition conditional comment.

From the Conditional Comment Wikipedia page

An integer corresponding to the edition of Windows used to view the Web page. Returns a Boolean value of true if the value matches the edition being used. For information about supported values and the editions they describe, see the pdwReturnedProductType parameter of the GetProductInfo function.

emphasis is mine. By edition they mean Home, Home Starter, Professional, Ultimate, etc.

The MSDN page for the GetProductInfo function supports this. The page also lists the input parameters for GetProductInfo which include

dwOSMajorVersion [in]

The major version number of the operating system. The minimum value is 6.

Version 6 corresponds to Vista, so I suspect Windows XP and versions of Windows older than XP do not have this GetProductInfo function, cannot call it and won't return anything to compare to the conditional comment in IE.

Sign up to request clarification or add additional context in comments.

1 Comment

So I can just do <!--[if !WindowsEdition]>Make the switch to Firefox/Chrome<![endif]--> <!--[if WindowsEdition]>Upgrade to IE9!<![endif]-->? That's perfect. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.