How do I make an "else" in an IE HTML conditional?
<!--[if lt IE 9]>
This is less then IE9
ELSE
this is all browsers: firefox, chrome, etc.
<![endif]-->
How do I do this in my HTML? I want to do an "else" ...
You're not looking for an else, you're looking for <![if !IE]> <something or other> <!--[endif]>
(note that this is not a comment).
<!--[if IE]>
You're using IE!
<![endif]-->
<![if !IE]>
You're using something else!
<![endif]>
You can find documentation on the conditional comments here.
I use the following to load resources in IE9 or newer and all other browsers
<!--[if gte IE 9]><!-->
//your style or script
<!--<![endif]-->
This is hard to believe. Look the opening and closing if statement sections are inside comments (so, its not visible to other browsers) but visible to IE.
The solution for your problem is (note the use of <!-- -->
):
<!--[if lt IE 9]>
This is less then IE9
<![endif]-->
<!--[if gt IE 8]> <!-- -->
this is all browsers: IE9 or higher, firefox, chrome, etc.
<!-- <![endif]-->
conditional comments can be in scripts as well as in html-
/*@cc_on
@if(@_jscript_version> 5.5){
navigator.IEmod= document.documentMode? document.documentMode:
window.XMLHttpRequest? 7: 6;
}
@else{
alert('your '+navigator.appName+' is older than dirt.');
}
@end
@*/