I would like to get a script that can capture the user agent of the user and assign an attribute to it.
I create a contact form for problems with the site, and I usually need to know which browser it uses. How to define a user agent string and specify it as the value of an input element.
My html looks something like this:
<input type="hidden" id="UserAgent" name="User Agent" />
I want the user agent to be added to it as a value attribute, so that it looks like this:
<input type="hidden" id="UserAgent" name="User Agent" value="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.53.11 (KHTML, like Gecko) Version/5.1.3 Safari/534.53.10" />
javascript jquery prop attributes user-agent
henryaaron Feb 26 2018-12-12T00 : 00Z
source share