var proxy = "HTTP 45.32.113.95:25; DIRECT"; var domains = { "localhost": 1 }; var direct = 'DIRECT;'; var hasOwnProperty = Object.hasOwnProperty; function FindProxyForURL(url, host) { var suffix; var pos = host.lastIndexOf('.'); while(1) { suffix = host.substring(pos + 1); if (hasOwnProperty.call(domains, suffix)) { return proxy; } if (pos <= 0) { break; } pos = host.lastIndexOf('.', pos - 1); } return proxy; }