When a browser makes a request to the server, it sends information such as its operating system name, version in addition to the type of the browser from which the request originates in the header variable "user-agent".
Depending on the request made, server responds back with specific details which can range from browser specific
css layout to calling certain
javascriptsfor certain browsers.
Changing the
user-agent also helps us in understanding how spider-agents or bots will see the pages that we build. It also helps us design applications that will mimic a request as originating from a mobile phone and helps us in viewing the behavior of the application in different mobile clients.
To read more about HTTP-Headers check
ietf