Windows 8 Internet Explorer proxy automation script

Posted by Stefan Bollmann on Server Fault See other posts from Server Fault or by Stefan Bollmann
Published on 2014-08-14T07:30:04Z Indexed on 2014/08/21 10:22 UTC
Read the original article Hit count: 374

Similar to this post, I'd like to change my proxy settings using a script. However, it fails. When I am behind the proxy, IE does not connect to the internet. Here I try the first solution from craig:

function FindProxyForURL(url, host) 
{ 
 if (isInNet(myIpAddress(), "myactualip", "myactualsubnetip")) 
  return "PROXY proxyasshowninpicture:portihavetouseforthisproxy_see_picture"; 
 else 
  return "DIRECT"; 
}

Also this test, where isInNet should surely return true does not help:

function FindProxyForURL(url, host) 
{ 
 if (isInNet("myactualip", "myactualip", "myactualsubnetip")) 
  return "PROXY proxyasshowninpicture:portihavetouseforthisproxy_see_picture"; 
 else 
  return "DIRECT"; 
}

**This script is saved as proxy.pac in c:\windows and my configuration is* in LAN settings: No automatically detected settings, yes, use automatic config script: file://c:/windows/proxy.pac No proxy server.

*(i am not allowed to post screenshots..)

So, what am I doing wrong?

---------------- update --------------

However, when I set up a proxy in my LAN configurations:

IE -> Internet Options -> Connections -> LAN Settings 
check: Use a proxy Server for your LAN
Address: <a pingable proxy> Port: <portnr>

everything is fine for this environment. Now I try a simpler script like

function FindProxyForURL(url, host)
{
    return "PROXY <pingable proxy>:<portnr>; DIRECT";
}

With a configuration described above** I am not able to get through the proxy.

© Server Fault or respective owner

Related posts about proxy

Related posts about internet-explorer