2010
03.03

This problem manifested itself in both the new Opera and Google Chrome browsers. The pac file worked perfectly in Firefox and IE, but refused to work at all in Opera and Chrome.

This is what the original pac file looked like:

function FindProxyForURL(url, host)
{
  if (isInNet(myIpAddress(), "10.200.0.0", "255.255.0.0"))
    return "PROXY 10.100.0.99:8080; SOCKS 10.100.0.99:1080";
  else
    return "DIRECT";
}



This code is in a “myproxy.pac” file hosted on a web server on my PC. I then reference the url of the file in my browser’s pac file setting: “http://localhost/myproxy.pac”.

The solution was simply to remove the leading spaces for the lines in the function, like so:

function FindProxyForURL(url, host)
{
if (isInNet(myIpAddress(), "10.200.0.0", "255.255.0.0"))
return "PROXY 10.100.0.99:8080; SOCKS 10.100.0.99:1080";
else
return "DIRECT";
}



And now it works!

So, my assumption is that Opera and Chrome prefer messy code.

No Comment.

Add Your Comment