Add more test log

This commit is contained in:
Faisal Salman 2024-12-17 07:17:03 +07:00
parent 6095c4c370
commit eba73ed6bb
2 changed files with 25 additions and 4 deletions

View File

@ -99,7 +99,7 @@ $(document)
$('#demo-result').get(0).scrollIntoView(); $('#demo-result').get(0).scrollIntoView();
updateDemo(UAParser(qs)); updateDemo(UAParser(qs));
} else { } else {
UAParser().withClientHints().then(function(result) { (UAParser().withFeatureCheck()).withClientHints().then(function(result) {
updateDemo(result); updateDemo(result);
}); });
} }

View File

@ -1,9 +1,30 @@
<script src="../js/ua-parser.js"></script> <script src="../js/ua-parser.js"></script>
<script> <script>
try { try {
var result = JSON.stringify(UAParser(), null, "\t"); UAParser().withClientHints().then(function (result) {
document.write("<pre>" + result + "</pre>"); var uap = JSON.stringify(result.withFeatureCheck(), null, "\t");
console.log(result); document.write("<p><pre>UAParser.js:\n" + uap + "</pre></p>");
console.log('UAParser.js result: ', uap);
if (navigator.userAgentData) {
navigator.userAgentData
.getHighEntropyValues([
"brands",
"mobile",
"platform",
"architecture",
"bitness",
"formFactors",
"model",
"platformVersion",
"fullVersionList",
"wow64"
])
.then(function (values) {
document.write("<pre>Client Hints:\n" + JSON.stringify(values, null, "\t") + "</pre>");
console.log('Client Hints result: ', values);
});
};
});
} catch (e) { } catch (e) {
document.write("Error: " + e); document.write("Error: " + e);
} }