How to get user agent from a thymeleaf html page -


in application using spring + thymeleaf. want user agent including cetain files.

 <%      string browser = request.getheader("user-agent") %> 

i need done in thymeleaf page.how can that. appreciated

you can access httpservletrequest object #httpservletrequest

so, example, can print user agent

 <span th:text="${#httpservletrequest.getrequest('user-agent')}">mozilla/5.0 (compatible; msie 10.0; windows nt 6.1; trident/5.0)</span 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -