// 在浏览器中设置:
// file://D:/Desktop/test.pac
function FindProxyForURL(url,host)
{
    // 在家
    if(shExpMatch(myIpAddress(),"192.168.1.*"))
    {
        return "direct";
    }
    else
    {
        // 在办公室
        if(shExpMatch(host,"172.16.*") ||
           shExpMatch(host,"*cmsz*"))
        {
            return "direct";
        }
        else if( shExpMatch(host,"*sina*") ||
                 shExpMatch(host,"*163*") )
        {
            return "proxy 61.50.■■■■■:■■■■■";
        }
        else
        {
            return "proxy 192.168.■■■■■:■■■■■";
        }
    }
}

 
参考:
http://www.cnblogs.com/ttyp/archive/2005/11/18/279124.html 《自动配置IE代理脚本》
http://technet.microsoft.com/en-us/library/dd361950.aspx 《JavaScript or JScript Auto-Proxy Example Files》
http://support.microsoft.com/kb/271361 《如何在 Internet Explorer 中禁用自动代理缓存》
http://support.microsoft.com/kb/274204 《.Pac 文件中的 shExpMatch 函数不支持正则表达式》


本文链接地址: 浏览器的自动代理脚本示例
https://blog.qingfengju.com/index.asp?id=377

分类:脚本编程 查看次数:7654 发布时间:2014/9/11 17:25:14