This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Not familiar with this syntax Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Not familiar with this syntax" Watch "Not familiar with this syntax" New topic
Author

Not familiar with this syntax

M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
In a JSP I am working on, I see this...

<!--[if IE]>

<![endif]-->

What language is this? Also, IE 10 does not recognize it.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

If you look closely at the syntax, you'll see that's just an HTML comment. All browsers but IE just ignore it as a comment.

IE parses the comment and treats it as a conditional. It's completely non-standard.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Another variant you might come across (this comes from HTML5 Boilerplate):


Again notice how it's just a comment that will be ignored non-IE browsers.
M Burke
Ranch Hand

Joined: Jun 25, 2004
Posts: 388
I see, thank you. I will change it to JSTL's c:if
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Why? If it works, why upset the apple cart?
Pavel Sok
Greenhorn

Joined: Nov 23, 2013
Posts: 10
Such HTML statement is used in creating forks during the parsing web page by browsers. So use this instead of propagating unnecessary JSTL's tags.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Not familiar with this syntax