JavaScript – browser user agent.

This is a simple tutorial with java script to see the browser user agent.
About user agent:
– user agents are unique to every visitor on the web;
– everyone that is browsing the web right now has a user agent;
– browsers are a example of a user agent;
– other tools can act as agents;
– user agent has identified itself to the web server with a process called content negotiation;
– it’s possible to send a fake user agent, a process known as “spoofing.”
Now about how to see the user agent with browser.
Let’s start with create your folder and add a index.html file.
Add also into this folder another folder named js.
Into js folder add a file named index.js file.
Into index.html file add this source code:

Into index.js file add this source code:

When you open the index.html file with your browser the you can see your browser user agent.
For example the result of this script into my browser is:

admin

born 1976

Posted in All, HTML 5, javascript. Tagged with , , , , , .