You cannot do this in a semi-decent browser due to security issues associated with it. You do not want XSS scripts to change request headers and work on your site.
However, I believe that IE uses a workaround if you use VBScript :
MyHttp.setRequestHeader "User-Agent", "MyCustomUser"
- , GET, .