I need to find user agent information in a widget. Is there a way we can do it using velocity?
Any advise or guidance would be greatly appreciated.
I need to find user agent information in a widget. Is there a way we can do it using velocity?
Any advise or guidance would be greatly appreciated.
You can embed javascript via the widget (either inline or in an attached file) to get the user agent info.
Agreed that would be the easiest way.
If you need to deliver this server side, you can use a widget-defined ajax endpoint to send it.
Additionally, it is possible to add your own velocity extension with a plugin if you must collect this server-side for some reason.
Out of curiosity, what are you needing to do with the user agent?
Thank you, Steven and Michael! I need to identify the internal apps which are crawling to get community forum data
In that case, you may want to go server-side. I mentioned previously about how you can write your own velocity extension with a plugin, and that's still an option. But if this potentially is to detect requests and doesn't have any of its own UI, you could maybe not even use a widget and just a plugin that loads along with the page. And in that plugin, you could detect the user agent and act on it accordingly. One possible plugin type would be the IHtmlHeaderExtension, which can execute along with every page request.