Gate: get information about the browser
You can grab browser information using the following code
getApplication () getRequestCycleSettings () setGatherExtendedBrowserInfo (true); ..
WebClientInfo w = (WebClientInfo) getWebRequestCycle (). getClientInfo (); ClientProperties cp = w.getProperties ();
// do something with the data cp.getNavigatorAppName ();
cp.getNavigatorAppCodeName ();
cp.getNavigatorAppVersion ();
cp.getBrowserVersionMajor ();
cp.getBrowserVersionMinor ();
Excerpt from WICKET Documentation
EDIT Updated from comments.
The above code is for Wicket 1.4.x. For newer Wicket versions, replace getWebRequestCycle () with getRequestCycle ()
source to share
If getRequestCycle()
not getClientInfo()
(for example, it wasn't for me either), you can try to answer this question:
User agent validation in Wicket
WebSession.get().getClientInfo();
This worked for me.
source to share
Wicket 6.x also provides org.apache.wicket.ajax.AjaxClientInfoBehavior
. A demo of this can be seen at: http://www.wicket-library.com/wicket-examples-6.0.x/ajaxhellobrowser/
source to share