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 8 - 2022.03 LTS
antonio
 
Posts: 638
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
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
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 2 guests