How to get current user agent string from macOS HTMLViewer?

Thanks, Tim: this is perfect, I hadn’t considered trying to do this via JavaScript.