1

I am writing a javascript code to auto switch the proxy settings based on the IP of the network on which my system gets plugged into.
Like when I am into the LAN of my company, it'll automatically use company's proxy, if on Client's network then use clien't proxy, and when in home then use auto-proxy.
But my proxy.pac file isn't working in Windows 10 Pro Version 10.0.17763 Build 17763.
Content of the file:

function FindProxyForURL(url, host)
{
    var ip = myIpAddress();

    //When on the Company network 
    if (shExpMatch(ip, "11.19.*")){
        return "PROXY proxy.mycompany.com:8080";
    }

    //When on ClientNetwork 
    else if (shExpMatch(ip, "11.11.*")){
        return "PROXY prxy-ca-01p.citi.state.com:8080";
    }

    //Your home network
    else{
        return "DIRECT";
    }
}

In the Chrome Browser's Settings>Proxy>Script Address I am giving the URL like file://C:\Users\Me\Desktop\proxy.pac.
Is there something wrong in the .pac file, or Windows 10 doesn't support it ?

aiman
  • 1,049
  • 19
  • 57

0 Answers0