Hi LFCPD,
I agree with Lothar that you should try to achieve your objective
without recourse to detecting the browser.
You are not clear if a) you are inserting the Strings in program code
or b) user is typing them in.
If a) you could back your TextArea entries with a simple model e.g.
String [] days or List<String> days and use that later in your code.
If b) you could consider using e.g. a FlexTable with one row per day,
use KeyBoardListener/KeyboardListenerAdapter to pick up <enter> press
and prepare next input row. This should be more robust, albeit more
complicated to code.
If you absolutely must detect the browser you can do it something like
this (I've retired this code now so it's probably out of date).
public class Browser {
public static boolean isIE() {
return getBrowserType().equals("ie6");
}
public static native String getBrowserType() /*-{
var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf("opera") != -1) {
return "opera";
}
else if (ua.indexOf("webkit") != -1) {
return "safari";
}
else if ((ua.indexOf("msie 6.0") != -1) ||
(ua.indexOf("msie 7.0") != -1)) {
return "ie6";
}
else if (ua.indexOf("gecko") != -1) {
var result = /rv:([0-9]+)\.([0-9]+)/.exec
(ua);
if (result && result.length == 3) {
var version = (parseInt(result[1]) * 10) +
parseInt(result[2]);
if (version >= 18)
return "gecko1_8";
}
return "gecko";
}
return "unknown";
}-*/;
}
regards
gregor
On Jan 21, 12:12 pm, LFCPD <[email protected]> wrote:
> Thank Lothar for answering so fast.
>
> My problem may be solved in another way, but I didn't find it and I'm
> desperate. The problem I have in my application is the following one:
>
> In a TextArea I insert different strings separated by a new line
> symbol ('\n'). And they are shown well in Firefox and in IE.
> i.e.: If I insert the string: Monday\nTuesday\nWednesday\n...
> It is shown like this in the textArea:
> Monday
> Tuesday
> Wednesday
>
> Later in the code I need to read the content of the TextArea, and
> divide the strings I insterted before separated by '\n'. In Ie is done
> well, bot not in Firefox, in firefox i get the following:
> Monda
> Tuesda
> Wednesda
>
> how can I solve it?
>
> Thanks in advance!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---