UAParser.js Jump Start PRO

There are many cases in which we need to get exact information about the client on which the code we wrote in JavaScript is running. Getting the information we need out of the user-agent is not straight forward. Using the UAParser.js lightweight JavaScript library it becomes much simpler.

The following demo shows how simple it is to us this library in order to get the exact information we need out of the user-agent.

<!DOCTYPE html>
<html>
<head>
    <title>UAParser.js Demo</title>
    <script type="text/javascript" src="ua-parser.min.js"></script>
</head>
<body>
    <script type="text/javascript">
        var parser = new UAParser();
        var result = parser.getResult();
        document.writeln("<br>browser.name="+result.browser.name);
        document.writeln("<br>browser.major="+result.browser.major);
        document.writeln("<br>browser.version="+result.browser.version);
        document.writeln("<br>os.name="+result.os.name);
        document.writeln("<br>os.version="+result.os.version);
        document.writeln("<br>engine.name="+result.engine.name);
        document.writeln("<br>cpu.architecture="+result.cpu.architecture);
    </script>
</body>
</html>

The following video clip overviews this code sample, shows its execution and explains it.

You can find more code samples, slides and video clips for learning this library in my free online courses website at http://abelski.lifemichael.com.

Share:

The Visitor Design Pattern

The Visitor Design Pattern

The visitor design pattern allows us to add operations to objects that already exist without modifying their classes and without extending them.

What are Anti Patterns?

Anti Patterns

Unlike design patterns, anti patterns just seem to be a solution. However, they are not a solution and they cause additional costs.

Virtual Threads in Java Professional Seminar

Virtual Threads in Java

The use of virtual threads can assist us with improving the performance of our code. Learn how to use virtual threads effectively.

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences