There is an easy way to get in server-side javascript in a XPage the User-Agent string from the request header. You can use this also to get other headers in the request.

facesContext.getRequest().getRequestHeaderMap().get("User-Agent");

This returns:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.125 Safari/533.4

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)

Commentary

  1. Co wrote on 05. Aug 2010

    Deze tip werkt inderdaad prima en je hebt zo geen client-side code nodig!

    Waarvoor dank!

Leave a reply