Use Navigator.language or the first value of Navigator.languages if available, otherwise return defaultLang.
Use a regular expression to test the navigator.userAgent property to figure out if the device is a mobile device or a desktop.
Modern operating systems allow users to choose the appearance they would like to see in all applications. The option can be detected by looking at the prefers-color-scheme media query.
Use this script to show visitors an interesting detail about their screen – the size of their browser window!! You might use this script to suggest that your visitors expand their browser to a larger size before accessing your site.
Whether it’s ethical or not, getting information on your site’s visitors is just plain neat. As one of the most requested scripts, this little gem will allow you to get the user’s IP address! Neat!