Jun 5, 2013

How to determine the user browser version in html?

Since this code, is only application in IE(Internet Explorer). Maybe the question is, How to determine the browser version in html.

This this check is the user user IE Browser, whatever the version.
<!--[if IE]>
Place content here to target all Internet Explorer users.
<![endif]-->

This was opposite behavior on the first item. "This is only run when the browser is NOT Internet Explorer".
<![if !IE]>
Place content here to target all users not using Internet Explorer.
<![endif]>

This will run if the browser version is greater than or equal to 8.
<!--[if gte IE 8]>
Place content here to target users of Internet Explorer 8 or higher.
<![endif]-->

A similar example above that only runs when the browser version is less than 7 (i.e. 6 or lower).
<!--[if lt IE 7]>
Place content here to target users of Internet Explorer 6 or lower (less than 7).
<![endif]-->

Conclusion:
The code/conditions are only run when running on IE browser, otherwise the browser will detect/treat as normal comment.

No comments: