Browser Detection?

Forum to discuss the Web client version of Servoy.

Re: Browser Detection?

Postby Yeroc » Fri Sep 23, 2011 1:31 am

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:

Code: Select all
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
Yeroc
 
Posts: 109
Joined: Tue Aug 12, 2008 1:12 am
Location: Calgary, AB, Canada

Re: Browser Detection?

Postby antonio » Sat Jan 28, 2012 7:08 am

Awesome, great tip!
Anything else useful we can get from .getClientInfo() ?
Tony
Servoy Developer Version 5.2.16
Developer MAC OSX 10.8.4 Java version 1.6.0_51
Production Debian Linux Java version 1.6.0_29
antonio
 
Posts: 622
Joined: Sun Apr 02, 2006 2:14 am
Location: Australia

Re: Browser Detection?

Postby ROCLASI » Sat Jan 28, 2012 11:25 am

Hi Antonio,
antonio wrote:Anything else useful we can get from .getClientInfo() ?

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

Hope this helps.
Robert Ivens
ROCLASI Software Solutions / JBS Group, Partner
SAN Developer / Servoy Valued Professional / Servoy Certified Developer
Twitter: @roclasi / @servoyforge
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5284
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Browser Detection?

Postby bobcusick1332964082 » Thu Jun 27, 2013 3:16 pm

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

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

Bob
bobcusick1332964082
 
Posts: 85
Joined: Wed Mar 28, 2012 9:48 pm

Previous

Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 3 guests