ua-parser-js test
by Admiral Potato
HTML
<script src="https://unpkg.com/[email protected]/dist/ua-parser.min.js"></script>
<h2>UA Parser output</h2>
<pre id="output_ua"></pre>
<h2>window.navigator output</h2>
<pre id="output_navigator"></pre>
JavaScript
var ouputUa = document.getElementById('output_ua')
var ouputNavigator = document.getElementById('output_navigator')
var parser = new window.UAParser().getResult()
console.log(parser)
ouputUa.innerHTML = JSON.stringify(
parser,
null,
' '
)
ouputNavigator.innerHTML = JSON.stringify(
Object.keys(window.Navigator.prototype).reduce((output, value) => {
output[value] = window.navigator[value]
return output
}, {}),
null,
' '
)