Skip to Content
Former Member
Jan 25, 2008 at 04:22 PM

Identifying browser/device


Hello all.

Is there a way to identify a browser or device in runtime? I want to write a piece of code that checks if the user is accessing the application through a normal browser (IE/Firefox) or using a mobile device (Blackberry), so my app can redirect to a more complex UI in case of ordinary browsers or to a simpler UI (fewer fields) in case of a mobile device.

I tried this without success:

ClientInfoFactory factory = ClientInfoFactory.newInstance();

ClientInfo clientInfo = factory.newClientInfo();

IWDProtocolAdapter protAdapter = WDProtocolAdapter.getProtocolAdapter();

IWDRequest request = protAdapter.getRequestObject();


String deviceName = clientInfo.getDeviceName();

I get ClassNotFoundException or NullPointerException depending on how clientinfo.jar is referrenced in the project.

Anyone knows any solution to this? Any help is appreciated,