Proxy autoconfig & choice of filtering or not

Chuck Bearden cbearden at sparc.hpl.lib.tx.us
Tue Nov 4 07:09:56 EST 1997


I have just discovered the wonderful world of proxy autoconfig
files. I understand the basics of writing and serving them, but I
would like advice on a more advanced application.  

Can I create a pair of Javascript buttons in a browser window, one
for filtered access and one for non-filtered access, such that 
clicking on the one for filtered access will automatically set the 
browser to go through our filtering proxy, and such that clicking on 
the one for non-filtered access will undo any proxy settings that may 
have been set?  We're running Netscape 3.0x at the moment.  

I can imagine this being accomplished in two ways.  In the first,
Javascript embedded in the page in question evaluates the user's
action (which of two buttons are clicked) modifies the browser's
behavior accordingly.  I would perhaps make this page or section
retrievable only by workstations whose IP addresses are in our ranges
(conditional includes or MultiViews or something).  This possibility
scares me a little bit, because it suggests that anyone could write a
clever Javascript to hijack an unwitting browser's connections to
pass through an arbitrary proxy that may well rewrite subsequent
URLs, or even page content.  I also suspect that Netscape calls the
FindProxyForURL function internally, as it prepares to retrieve a
URL, and won't pay attention to its value generated on the web page. 

The second way I imagine is to write a proxy autoconfig file in such
a way that it can take values passed to it from a Javascript embedded
in the page with the buttons, and act conditionally on those values
to return PROXY or DIRECT instructions to the browser. I.e., there
are two pieces: the Javascript event handler in the page, which sets
up the buttons, evaluates the user's actions, and passes the results
to the proxy autoconfig, and the proxy autoconfig itself, that has to
be written in such a way as to be able to receive values from the
Javascript event handler embedded in the page and set proxying
behavior accordingly.  This method seems better to me.  

I have tried retrieving a .pac file through a link in a web page, but 
Netscape rejects proxy autoconfig files retrieved in this manner.  

Any ideas?  I do plan to work my way through Netscape's tutorials on 
Javascript bit by bit, but it will take a while to do that.  

Thanks in advance.

Chuck Bearden
Network Services Librarian
Houston Public Library
Houston, TX  77002
713/247-2264 (voice)
713/247-1182 (fax)
cbearden at hpl.lib.tx.us


More information about the Web4lib mailing list