I'm trying to write a proxy autoconfig script for Firefox so that I don't have to keep going into the settings to switch between the proxy settings for work and direct connection for home.

There are plenty of examples on the web, but the myIpAddress() function just returns the IP address of the loopback adapter (, not that of the currently used network interface.

I've also tried isResolvable() with an address on the work network that is a different subnet to the one I use at home, but the address still resolves at home even though I can't ping it.

Can anyone help?