<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>tag:www.local-guru.net,2005:/blog/tag/firefox</id>
  <link type="text/html" href="http://www.local-guru.net" rel="alternate"/>
  <link type="application/atom+xml" href="http://www.local-guru.net/blog/tag/firefox.atom" rel="self"/>
  <title>GuruBlog : Articles about firefox</title>
  <subtitle>local-guru.net</subtitle>
  <updated>2007-11-03T15:43:00+01:00</updated>
  <generator>GuruBlog engine</generator>
  <entry>
    <id>tag:www.local-guru.net,2005:Article/12</id>
    <published>2007-11-03T15:43:00+01:00</published>
    <updated>2007-11-03T15:43:00+01:00</updated>
    <link type="text/html" href="http://www.local-guru.net//blog/2007/11/3/automatic-proxy-configuration-in-firefox" rel="alternate"/>
    <author>
      <name>Nikolaus Gradwohl</name>
    </author>
    <title type="html">automatic proxy configuration in firefox</title>
    <category term="javascript" scheme="http://www.local-guru.net/blog/tag/javascript"/>
    <category term="firefox" scheme="http://www.local-guru.net/blog/tag/firefox"/>
    <category term="proxy" scheme="http://www.local-guru.net/blog/tag/proxy"/>
    <content type="html">&lt;p&gt;In an erlier article i describe how to switch between the network environments i am
using, but there was one programm i could not convince to let me change the proxy
settings via apple script - firefox.&lt;/p&gt;

&lt;p&gt;i still needet to switch the firefox settings per hand - something i didnt like at all.&lt;/p&gt;

&lt;p&gt;one day the little "fetch proxy settings for url" dialog part from the
firefox proxysettigns made me courious and i found out, that firefox
expects a javascript file on this url, which tells firefox what proxy to use.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;function FindProxyForURL(url, host) {
    if ( dnsResolve( host ) == "127.0.0.1" ) {
        return "DIRECT";
    } else {
        return "PROXY proxyhost:8080";
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;this script can use some predefined functions like "isInNet" or "dnsResolve" to
determine which network Im in and use the appropriate proxy. the file doesnt
even have to live on a http server, a file:// url is sufficient.&lt;/p&gt;

&lt;p&gt;e voila - no more manual proxy switching&lt;/p&gt;
</content>
  </entry>
</feed>

