Another Hack by the pickle: Hacking the User-Agent header sent by your WWW browser

Web browsers send a header to the server when you access a page called the User-Agent header. (Actually, they send several pieces of data, but we're only concerned with one here.) For more on the user-agent header and proper syntax, check out the page on user-agent strings.

Your browser is currently identifying itself to my server as (if you have JavaScript turned off, you won't see anything here)

You might want to take a screen shot of this page or copy and paste the above line into Stickies so you have something to compare to later on.

This user-agent header is used by many servers to identify your browser version and platform and to subsequently direct you to a platform- or browser-specific page. For example, c|net uses the user-agent header when you click on the Downloads link from the home page to direct you to a Mac or PC download page. The so-called "requirements" that some web sites claim are often excessive and the page will work just fine on a browser that the server claims is too old. (Online banks are some of the worst offenders, and often claim they won't work with IE 5 for the Mac because IE 5 reports as Netscape 4.)

To change the User-Agent header in Netscape Navigator 4.0x or Communicator 4.5-4.7x:

  1. Open a COPY of your browser with ResEdit or other resource editor.
  2. Open the STR# resources.
  3. Open resource ID #210, called "IDs."
  4. Change strings 4 and 5 to read "(Windows; %s; NT4.0)" (no quotes). Copy and paste the text between the quotes if you want. You can also use "Win98" or "Win95" instead of "NT4.0". Leave everything else alone.
  5. You can change the version number (stored in string 2 of the resource) with the following caveat: changing the version number in Netscape will break the security certificates. It's probably possible to use Communicator's certificates and change Navigator's User-Agent header to reflect the same version number as the browser from which security certificates came.

To edit the User-Agent header in IE 5.0x (probably 4.5 as well):

  1. Open a COPY of your browser with HexEdit, an editor that allows you to edit and search the data fork of files. Make sure you open the data fork.
  2. Use the Find command (command-F) to search for "Mac_", without the quotes, matching ASCII (not hex).
  3. You'll find the following starting on line 3026A0 and running to 3026E0 (may differ slightly in IE 4.5, no quotes, of course):
     (compatible; %s; Mac_%s).PowerPC.%s (compatible; %s; Mac_%s; %s).
  4. Replace that string EXACTLY as shown (without the quotes):
    " (Windows; U; NT4.0)     .PowerPC.%s (Windows; U; NT4.0; %s)     ."
    The key is that the replacement string be EXACTLY the same length as the old string. (In this case, there are five spaces after each right parenthesis before the next period to make up for the lost characters inside.) There is a checksum on the data fork length and if the checksum fails, the program will be rendered completely inoperable.
  5. To make things complete, open the edited browser in ResEdit or other resource editor.
  6. Open ID #2000 of the STR# resources, called "Vendor Info."
  7. Change string 3, "Mozilla/4.0", to read "Mozilla/6.0" or whatever you wish.

If your edited browser simply won't launch you didn't do the hack right. If you need instructions for hacking MSIE that ships with OS X, see this page.

Your browser should now identify itself as a PC browser to any web site that uses a user-agent header to direct you to a specific page.

If anyone is interested in hacks for some of the older browsers (Netscape 3, IE 3, Netscape 2, etc.) I'll see what I can do. I highly doubt this is a good idea, since most browsers earlier than 4.x versions truly cannot handle the most advanced pages on the 'Net these days.

iCab apparently has a preference setting for the User-Agent header. The user can change this to appear as whichever browser he/she wants, although I don't know if it will also do platform masquerading as well. (I don't use iCab.)

DISCLAIMER: I take no responsibility for ANY damage you do to your computer, your software, yourself, or others as a result of this hack. YOU, the user, are ENTIRELY RESPONSIBLE FOR YOUR OWN ACTIONS.

Recognition with which this hack has been honoured:

This hack was brought to you by...
the pickle
Last Modified: 28 Apr 2001.

Back to Index