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 mozilla.org 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 edit the User-Agent header in IE 5.1b for OS X (later versions should be roughly the same but line numbers may change somewhat):

  1. Download HexEdit, an editor that allows you to edit and search the data fork of files.
  2. Open Internet Explorer.app -> Contents -> Resources and then open the appropriate .lproj file for your language of OS X.
  3. Open the Resources.rsrc file in the appropriate .lproj folder from within HexEdit. Make sure you open the data fork.
  4. Use the Find command (command-F) to search for "Mozilla", without the quotes, matching ASCII (not hex).
  5. You'll find the following starting on line 051C0 and running to 051F0 (no quotes, of course):
    " (compatible; MSIE 5.0; Macintosh; %s; %s)"
  6. Replace that string with an appropriate string of EXACTLY the same length as the old string. (That's 39 characters for those of you too lazy to count. Spaces after the parentheses don't seem to affect functionality so they make good filler data.) There is a checksum on the data fork length and if the checksum fails, the program will be rendered completely inoperable.

Note that I haven't been able to thoroughly test this hack; if you have trouble with the hack, double-check the instructions, make sure you didn't alter the data fork length AT ALL, check the instructions again, check the data fork again, and then let me know specifically what the problem was. If your edited browser simply won't launch you didn't do the hack right. If this happens to you, I suggest you get a different browser. Chimera and iCab are both far superior to anything Microsoft has ever dreamed of and both rarely (if ever) need to have the user-agent string changed. iCab even allows you to send whatever user-agent string you want by configuring a specific setting in the prefs.

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.

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. This hack was brought to you by...
the pickle
Last Modified: 28 Apr 2001.

Back to Index