Check User-Agent with jsf

前端 未结 3 505
傲寒
傲寒 2020-12-19 18:25

I want to check the user agent of my client. (If it\'s possible the browser type/version)

But I don\'t know how do that...

Thank you for your help.

3条回答
  •  半阙折子戏
    2020-12-19 18:59

    It is sent in the User-Agent http header.

    HttpServletRequest request = (HttpServletRequest)context.getExternalContext().getRequest();
    String userAgent = request.getHeader("user-agent");
    

提交回复
热议问题