A blog about the things I'm into: computers, music, books, general thoughts ...and stuff

Wednesday, August 24, 2005

Using Proxy.pac File To Automatically Configure Browsers for Proxy

As someone who uses a notebook PC between work and home I have constantly needed to switch off and on my internet proxy settings.

I finally got sick of doing this and discovered that with a special file called proxy.pac I can automatically detect whether to use a proxy or not.

The file is a special Javascript routine such as this...



function FindProxyForURL(url, host)
{
// variable strings to return
var proxy_yes = "PROXY ieproxy2:8081";
var proxy_no = "DIRECT";
if (shExpMatch(url, "http://www.mycompanywebsite.com*")) { return proxy_no; }
if (shExpMatch(url, "http://www.myotherwebsite.com*")) { return proxy_no; }
if (shExpMatch(url, "http://www.my3rdlocalsite.com*")) { return proxy_no; }
if (shExpMatch(url, "http://10.200.*")) { return proxy_no; }
// Proxy if PC is on local LAN
if (isInNet(myIpAddress(), "10.200.0.0", "255.255.0.0"))
return proxy_yes;
else
return proxy_no;
}

Google Slut

I am such a Google Slut.

Anything they release I just can't wait to install, the latest being Google Talk and version 2 of the Desktop search...