Getting IE automated proxy settings from Java or JScript?

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Chris Frederick (cfrederick_at_cox.net)
Date: 05/25/04


Date: Tue, 25 May 2004 10:23:03 -0400

I've been researching this on and off for weeks, and haven't come up with
anything useful yet. If anyone knows how to do this, please let me know.
>From a Java applet running in IE 6.0 using the Sun J2SE 1.4.2_03 plug-in, I
need to retrieve the proxy host and port that will be used to access a
specific URL. The site with the client machines is using automated proxy
settings (i.e., a ".pac" file) to retrieve the proxy server address and port
number.

So basically, I need to do one of two things:

1. From either Java or Javascript/Jscript, find the URL to the PAC file
that is stored in the browser configuration. Open that URL, and execute the
FindProxyForURL() Javascript function therein.
2. Even better, find a way to access the copy of FindProxyForURL() that
Sun's documentation claims the Java Plug-in preloads when it starts. See
the following URL:
http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/proxie_config.html#automatic

The restrictions on my environment are:

1. I cannot use any native Windows code, whether called via JNI or exec(),
to read the registry value that contains the URL of the .pac file.
2. I cannot hard code the auto configuration URL, because remote
administration software can change it.
3. I cannot modify the Java code to use the URLConnection class and let the
JRE transparently handle the proxying.

The security permissions in the JRE's java.policy file may be relaxed,
within reason, to allow the applet to read (but not write) certain system
properties that are not readable by default. This is how I get the IE proxy
settings when it is NOT configured to use a .pac file, but as far as I can
tell, there is no Java property that provides the automated proxy URL if the
browser is configured to use one.

Thanks in advance for any advice that you can provide.

- Chris



Relevant Pages

  • Re: Proxy for external users
    ... Maybe another proxy only ... Seems a much better configuration would be a VPN, ... Then you could control them exactly like ... The routing and remote access snapin for W2K is ...
    (microsoft.public.isa)
  • Re: Urgent problem: Cannot connect to URL
    ... > webserver (without proxy). ... this wasn't possible from the client we found ... > on the second request the .pac file is downloaded from the proxy (as it ... > this was only the case when we were logged in as a normal user. ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: Urgent problem: Cannot connect to URL
    ... webserver (without proxy). ... this wasn't possible from the client we found ... on the second request the .pac file is downloaded from the proxy (as it ... Is that script affected by the Security settings ...
    (microsoft.public.windows.inetexplorer.ie6.browser)
  • Re: what to do with java.lang.reflect.Proxy ???
    ... > The main drawback I see with Proxy, is that I should re-engineer alot ... implementing MouseWheelListener can be used to support the ... mouse wheel on Java 1.4, for code that must also run on Java 1.3. ... I've seen stubs that ...
    (comp.lang.java.programmer)
  • Re: Internet Access problem on Fedora Core 4.
    ... was done to see if my DNS was misconfigured. ... I tried putting the proxy address as a value to nameserver, ... I then checked if my browser proxy configuration was set to direct ... PING 64.233.179.99 56bytes of data. ...
    (comp.os.linux.networking)