Check User-Agent with jsf

前端 未结 3 500
傲寒
傲寒 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 19:00

    In a JSF2 page, you can print the user agent directly via the request object:

    
    

    But don't forget to use the h-namespace ;-)

    
    

    You can then respond via functions to different browsers.

    Example:

    
    
    
        
            Facelet Title
        
        
            

    User-Agent:

    Hello Firefox!

提交回复
热议问题