I am developing a component in AEM 6.1 using sightly. Is there any way to detect the browser in backend JS code. Is there any api that exposes those details to backend JS?
Asked
Active
Viewed 762 times
1 Answers
0
The browser sends this information in the HTTP header. You can use userAgent (from request object) to identify browser details. You can write your own code to identify device/browser/os or use some service.

Community
- 1
- 1

Mohit Bansal
- 384
- 3
- 12
-
Hi @Mohit, thanks for answering.I have to move from slightly to JSP. I thought if there is a direct way to read the header from slightly code. – Zahid Jan 24 '16 at 23:08
-
you can use this information in Sightly also. create a class which extend WCMUse, you will implicitly get request object, fetch information. Call your class from your Sightly template. Always follow Sightly First !!! approach – Mohit Bansal Jan 24 '16 at 23:26
-
Sightly is a templating language, not meant to do any of processing, you have to write WCMUse classes for what you are trying to achieve. – Bambara Jan 26 '16 at 17:16