User.agent detection in CssResource not working?

10 views
Skip to first unread message

dougx

unread,
Mar 10, 2010, 3:11:01 AM3/10/10
to Google Web Toolkit
I'm havign trouble with a CssResource I'm using.
This is my css:

.Box {
border: 1px solid #f00;
}
@if user.agent ie6 {
.Box {
background: #f00;
}
}

It's pretty much straight out of the example here:
http://code.google.com/p/google-web-toolkit/wiki/CssResourceCookbook

The problem is that the user.agent detection doesn't seem to work.
That style is never added...

So I thought maybe I was doing it wrong? Tried this...

.Box {
border: 1px solid #f00;
}
@if user.agent ie6 {
.Box {
background: #f00;
}
} @elif (com.client.Com.Check()) {
.Box {
background: #0f0;
}
} @else {
.Box {
background: #00f;
}
}

where:
public static boolean Check() {
if (Navigator.getUserAgent().toLowerCase().contains("msie"))
return(true);
else
return(false);
}


...and as a result the div has a green background on ie, and blue on
everything else.

Anyone else having issues @if user.agent? Did something change in
2.0.3 so it doesn't work the same way anymore?

~
D.

Reply all
Reply to author
Forward
0 new messages