Created
December 29, 2016 19:59
-
-
Save lrobeson/c2cdaf9978bd71b979df91594aaf61b0 to your computer and use it in GitHub Desktop.
Add User-Agent info to HTML tag
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add User-Agent info to HTML tag, example: | |
// <html data-useragent="Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)"> | |
function addUserAgent() { | |
var doc = document.documentElement; | |
doc.setAttribute('data-useragent', navigator.userAgent); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment