Browser Detection?

Hello,

Is it possible to detect the browser (user agent) that’s connected? The reason I’d like to do this is for browsers on mobile clients (like Blazer on Palms). I’d like to show one form for mobile clients and another for “regular” browsers. I’ve looked at application.getApplicationType(), but I don’t think that will help. I guess I’m looking for getUserAgentString().

Can you find these settings in the system properties? If so I might be able to add a function to the tools plugin…

Marcel, can you access the environment where the WebClient is running in through a plugin? My understanding is that the context of the java environment for Webclients is the virtual client that is running on the server. So in that respect, I don’t think it’s possible to retrieve info regarding which browser is used. (but then again: I might be wrong…)

Regarding the ability to get the make and version of the browser used for the WebClient: I allready put in a feature request for that in the support system. Servoy has looked at it and responded that it will not make it into 3.0, but might make it into 3.1

Paul

Hmm, I didn’t realize we were talking webclient… Yet another thing to report (and/or ask for) when asking/answering questions I guess…

To be honest I don’t know that but one the other hand it should be possible to ask for it in the code shouldn’t it? Maybe sending some javascipt DOM function? Just thinking out loud, no real ‘fundament’ for the thought here…

Well, I guess we’re tsalking WC, because we’re talking about the userAgent and the browser…

Maybe somwhow you can access the WC clientside somehow, but I don’t think the exposed API offers that ability.

Allthough not completely sure, but I think it’s also not really possible to “talk” from the server to the WC clientside (so the part running in the browser, not the part running on the server).

Paul

Hello,

Yeah, I was referring to the webclient, not the headless client. Sorry if that was unclear (this is the Webclient forum though :wink: ) . For the mobile web browsers I need a simplified version of a given form, so I was just wondering how to distinguish, for example, Firefox from the Palm Blazer browser. Paul, thanks for the update. ::crossing fingers:: Let’s hope this feature makes it into 3.1.

Does anyone know if this feature was ever implemented? It would be very useful to know which browser a user was using.

TIA, J T

No, there’s no builtin function to get the type of browser. Why do you need it?

Paul

We are using Scott’s method to customize tabs in the webclient using a style sheet to override the default web styles. Due to some differences/bugs in older browsers (IE7), we need to make further accommodation to adjust for broken or unsupported styles.

we are happy with this: http://code.google.com/intl/nl/chrome/chromeframe/

with this, you can use the chrome render engine inside Internet Explorer (even IE 6!!)

It would be wonderfull, if we could detect if chromeframe is installed, if not show show such image:
[attachment=0]Afbeelding 50.png[/attachment]

Hi JT,

If it’s stylesheets you need to customize based on the browser it’s running on, why not use conditional comments inside the stylesheet?

Paul

@harjo: what’s the point of Google Chrome Frame inside IE?

Instead of upgrading their browser, users would have to install the “Google Chrome Frame” plugin into their Internet Explorer browser.

Only advantage would be for companies that have legacy apps build on top of IE5.5/6/7 that cannot or have not been ported to IE8/been made to support all browsers, thus they cannot upgrade to IE8 and who’s IT department does not allow users/does not want to install another modern browser besides the old IE instance.

Paul

@ Paul, what’s the point that Google Chrome Frame has build this for IE than? ;-)

the point is, that still 30-40% use IE6 (we can see this in our statistics of our webservers)
we think users, rather want to install a IE plugin in IE6, than upgrading it. (many users downgraded back to IE6 because of problems with IE7 in the beginning)

And for instance Servoy webclient runs much smoother (quicker) in chrome.

what’s the point that Google Chrome Frame has build this for IE than?

To somehow offer companies that cannot move away from ie6 for technical reasons a way to still offer their users a way to run Google Wave when it’s going to be released later this year.

Users should just upgrade their browsers of get another browser of they are allowed to do so :-)

Paul

I know in theory this is the best way. In practise, this is not the case ;-)

I was just looking for a way to do this recently and thought I’d post what I came up with in case this is useful for someone else. In my case, I just wanted to capture the browser information for logging purposes and add it as client info so that it shows up on the admin console as an extra bit of useful information:

function onLoad(event)
{
  if (application.getApplicationType() == APPLICATION_TYPES.WEB_CLIENT)
  {
    var useragent = Packages.org.apache.wicket.RequestCycle.get().getClientInfo().getUserAgent();
    application.addClientInfo(useragent);
    application.output("User Agent: " + useragent, LOGGINGLEVEL.INFO);
  }
}

Regards,
Corey

Awesome, great tip!
Anything else useful we can get from .getClientInfo() ?

Hi Antonio,

antonio:
Anything else useful we can get from .getClientInfo() ?

See http://wicket.apache.org/apidocs/1.4/or … tInfo.html

Hope this helps.

Cory (and Robert) - Seriously - THANK YOU! :lol:

This is JUST what I needed! Really helped out a lot!

Bob