PAC file issues

Having problems making IE 9 read the following PAC file. Can anyone see where my problem(s) lie in this syntax:

function FindProxyForURL(url,host)
// set ws1 and ws2 to the 2 proxies
var ws1=""
var ws2=""
// find the 4th octet - if even, is ws1/ws2 else ws2/ws1
var myip=myIpAddress()
var ipbits=myip.split(".")
var myseg=parseInt(ipbits[3])
if(myseg==Math.floor(myseg/2)*2) {
      var proxone=ws1
      var proxtwo=ws2
else {
      var proxone=ws2
      var proxtwo=ws1
// if name has no dots, or is our domain, or starts 172., or if my
// current address does not start 10. don't use proxy
if(isPlainHostName(host) ||
      dnsDomainIs(host,"") ||
      myip.substring(0,3)!=="10." ||
      host.substring(0,3)=="172."      )
// alert("direct")
return "DIRECT";
else {
// alert("proxy")
      return "PROXY "+proxone+":8080; PROXY "+proxtwo+":8080" ;
Who is Participating?
cowarlickConnect With a Mentor Author Commented:
I have discovered my problem. The pac file was not in ANSI, which is required for IE and Firefox to read it.
cowarlickAuthor Commented:
Have gone to a basic PAC file to see if maybe it is another issue. It still does not work. See code below:
function FindProxyForURL(url, host)
  return "PROXY";
Have attempted to use this pac file locally via file://C:/pxy/proxy.pac in both IE9, IE10, and firefox with no luck. Am I missing something?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.