How can I detect if a user is using mobile in Veloicty?
How can I detect if a user is using mobile in Veloicty?
What are you trying to do?
We know we can hide/show widgets if the users is using mobile or not. We want to change some output on a widget if a user is on mobile or not. What we are trying todo is possible with some JavaScript but it would be much better and cleaner if we could control it server side.
Some server-side implementations may still use the User-Agent header to attempt to detect a mobile browser (based on known user agent strings), this approach is generally no longer recommended in favor of testing specific capabilities within the browser (using client-side javascript or media queries in CSS).
You could detect capabilities on the client-side and write a cookie that you could read in Velocity via $core_v2_page.GetCookieValue()
Some server-side implementations may still use the User-Agent header to attempt to detect a mobile browser (based on known user agent strings), this approach is generally no longer recommended in favor of testing specific capabilities within the browser (using client-side javascript or media queries in CSS).
You could detect capabilities on the client-side and write a cookie that you could read in Velocity via $core_v2_page.GetCookieValue()