brown23 0 Newbie Poster

I'm having a little bit of a problem with JavaScript and a User Agent.

I'm using a C# Application, and a WebBrowser Control with a custom user agent. Now I'm currently looking at different ways on how to show different methods for specific user agents. I've got a little script that works lovely at what I want in PHP - but some parts of the website won't be able to execute server side languages, and some will have to be executed in the user's browser - so, I thought I would do a little script to check what JavaScript says my useragent is.

The script below compares the results of my Useragent between JavaScript and PHP:

<html>
   <body>
      <script type="text/javascript">
            document.write(navigator.userAgent);
      </script>
      <br/><br/>
      <?php
      echo $_SERVER['HTTP_USER_AGENT'];
      ?>
   </body>
</html>

When I'm using my C# Application with its custom useragent HelloWorld, PHP tells me my UserAgent is HelloWorld, which is what I want. But JavaScript on the other hand tells me its IE8 ... why?

My application customises the HTTP Headers, so does that mean JavaScript uses something else other than the HTTP Headers to determine what the user agent is? It's kind of annoying really.

All help is greatly appreciated,
Brownie.