We can get information about the user’s device. It returns a string containing the user browser’s name, version, operating system, etc.
Return Type: It returns the following string for a Windows desktop:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.85 Safari/537.36
Example: Using this property, we can easily predict that it is opened on a Desktop or Mobile Device as shown in the below code.
Output: Following will be the output for desktop browser:
You are using Desktop