privacy-sandbox-dev-support
privacy-sandbox-dev-support copied to clipboard
Chrome 97 On Android 10 - navigator.userAgentData Undefined
I'm using Chrome 97 on Android 10 (a Samsung Galaxy S9+). When I enable remote debugging and enter navigator.userAgentData in the Chrome DevTools Javascript console I get a return of undefined. Am I missing some configuration in Chrome 97 for Android? CanIUse.com reports that Chrome for Android supports userAgentData as of v90.
Hi Bill
Sorry to hear this isn't working!
I've tried this out in Chrome 97.0.4692.87 on Android 12 but I can't reproduce the error (i.e. it works for me). I don't have a Samsung Galaxy on hand — FWIW I tried an S9+ with DevTools on BrowserStack, and that seemed to work, but that may not be realistic.
I think you should try once more, using navigator.userAgentData from DevTools and, if it still doesn't work, then file a bug via crbug.com/new.
Sam
It would also be helpful if you could share the output from the demo page here: https://user-agent-client-hints.glitch.me/javascript.html
I did notice though, and I'll look into details on this, navigator.userAgentData is only available when you're inspecting an actual web page. So, if you're using the console to inspect something like the new tab page at chrome-native://newtab/ or about:blank then you will get undefined as if you look at the the navigator object in the console, you will see that fewer APIs are available.
And to expand, navigator.userAgentData requires a secure context, e.g. https://…. So, you will not see it available on insecure http:// pages or internal browser pages as well.
@rowan-m, Thanks for the reminder about using https://. That was the problem. Everything's working as expected now.
Great to hear - let's close here.