summaryrefslogtreecommitdiff
path: root/old/published/How To Wiki/how-to-user-agent.txt
blob: 08d58b75c262e014ca696b40de65f8d469c7d6f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
In the ugly early days of the interest websites were optimized for specific browsers. While this trend has largely disappeared there are still a few examples lingering in the far corners of the web. 

But lately the trend of block specific browsers has reared its ugly head again. This time "Firefox"<http://www.mozilla.com/en-US/firefox/> has been targeted by some sites unhappy with the "AdBlock Plus extension"<https://addons.mozilla.org/en-US/firefox/addon/1865> which blocks ads and thus hurts the site's bottom line. At the moment it's really just a handful of fringe sites using the technique as a means of gaining publicity, however, as both Firefox and AdBlock Plus grow in popularity, it could become a more common practice.

Naturally there's a way around all this browser blocking. Every browser identifies itself with something called a user-agent string. Because the string is arbitrary, it's easy to spoof the user-agent of a browser other than the one you're using.

^^^^ Firefox And Relatives

It's possible to change the user-agent string in Firefox by hand, but it's much easier to use the "User Agent Switch add-on"<https://addons.mozilla.org/en-US/firefox/addon/59>. Just install the extension and restart Firefox. You'll then see a new menu of user agent options under the Tools menu.

To spoof another browser, just select the user-agent you'd like and reload the page.

And note that this extension will work with Firefox, Flock, Mozilla, Netscape and any other browser built on the Mozilla platform that supports add-ons. This add-on will not, however, work with Camino. Luckily there's a "Camino Preference Pane"<http://pimpmycamino.com/parts/user-agent> that can accomplish the same thing.

^^^^ Safari

Safari has a built-in user-agent switching mechanism very much like the Firefox system above, the only catch in Safari is that you need to enable the "Debug" menu. The Debug menu offers a number of tools, but near the bottom of the options you'll find a "User Agent" heading. Just select the user agent you'd like to use and Safari will reload the page spoofing that browser.

To enable the Debug menu in Safari for Mac OS X, first close the application and then open up Application >> Terminal and type:

% defaults write com.apple.Safari IncludeDebugMenu 1

To turn it off again use the same command, but change the 1 to 0. If you don't want to muck about with the command line there are plenty of freeware apps the allow you to turn on the debug menu. Both "SafarIcon"<http://web.mac.com/reinholdpenner/Software/SafarIcon.html> and "Onyx"<http://www.titanium.free.fr/pgs2/english/onyx_tiger.html> can be used to turn on the Safari debug menu.

To Enable the Debug menu in Safari 3 for Windows open the file C:\Documents and Settings\USERNAME\Application Data\Apple Computer\Safari\Preferences in a text editor (NotePad will work). Add the following lines:

<key>IncludeDebugMenu</key>
<true/> 

Save the file and open up Safari, you should see the new debug menu on the righthand side of the toolbar.

^^^^ Opera

Opera used to automatically spoof the Internet Explorer user-agent, but recently the application stopped doing that. To change Opera's user agent just type "about:config" in the address bar. The resulting screen shows all the configuration settings section for Opera. Then search for "Spoof UserAgent ID."

You should see a drop down box with five numbers. The numbers represent:

*	1) Opera (default user agent)
*	2) Mozilla (but admitting to spoofing)
*	3) Internet Explorer (but admitting to spoofing)
*	4) Mozilla, without mentioning the spoofing
*	5) Internet Explorer, without mentioning spoof

Select the one you'd like and reload the page in question.

^^^^ Internet Explorer

Usually when you choose to spoof a browser agent, IE is the one you'll spoof, but in case you ever need IE to masquerade as something else here's how you do it. For Internet Explorer 7, download and install the "User Agent String Utility"<http://www.microsoft.com/downloads/details.aspx?familyid=9517db9c-3c0d-47fe-bd04-fad82a9aac9f&displaylang=en> from Microsoft, which makes it easy to change user agents. 

Internet Explorer 6 is a little tricker. To change the user agent for IE6 on XP you'll need to edit editing the Windows registry -- proceed at your own risk.

Open the registry (Start >> Run >> "regedit") and browse to find the following line:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Internet Settings\User Agent\Post Platform

Create a new sub-key called "Version," change the value to whatever user-agent you'd like to spoof.

^^^^ Why User Agent Spoofing is bad

Most browser manufacturers dislike user agent spoofing because, for the most part, any browser can render any page, the only thing stopping them is the website itself. If you spoof the user agent, these sites never know that you're using the browser you're using and have no incentive to change. If you're trying to access something that's been blocked for no good reason, by all means spoof your way in it, but take the time to write to the site and let them know that they should stop blocking your favorite browser.