Sometimes in my .jsp i use User-Agent in order to define what .css class or attribute to use dependently upon client's browser.
example:
<c:set var="browser" value="${header['User-Agent']}" scope="session"/>
<c:if test="${(fn:contains(browser,'Safari'))||(fn:contains(browser,'Chrome'))}">
<c:set var="cellClass" value="cell-nonFF"/>
</c:if>
<c:if test="${(fn:contains(browser,'Safri') == false)&&(fn:contains(browser,'MSIE') == false)}">
<c:set var="cellClass" value="cell-FF"/>
</c:if>
<c:if test="${fn:contains(browser,'MSIE')}">
<c:set var="cellClass" value="cell-IE"/>
</c:if>
Conditionals are valid for IE only, so for various browsers, I should define User-Agent such a way.
That way work's for now OK. But i suppose that there is another more graceful or stable way, because User-Agent definition for every browser are very mixed and we plan to support mobile browsers further.
Safari 4 detected as: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/528.16 (KHTML, like Gecko) Version/4.0 Safari/528.16
IE 6 detected as::Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; iOpus-I-M; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Is it more stable alternative?