Created
November 19, 2012 03:30
-
-
Save mub/4108790 to your computer and use it in GitHub Desktop.
Browsers trail
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Proxy Auto-Config file, see http://en.wikipedia.org/wiki/Proxy_auto-config | |
This would work with most browsers and more, do not need any heavy plugins with this script and it's more powerful, flexible and maintainable than | |
any of plugins. Instead of clicking through menus, just point to this file anywhere in your FS. | |
*/ | |
function FindProxyForURL(url, host) { | |
/* example with using regex: | |
var regexpr = /[a-zA-Z]{4}.microsoft.com/; | |
if(regexpr.test(host)) { ... | |
*/ | |
if ((host == "localhost") || (shExpMatch(host, "localhost.*")) || (host == "127.0.0.1")) { return "DIRECT"; } | |
if (shExpMatch(host, "that*One*cluster.vip.acme.com")) { | |
// do not use alerts with Opera, alerts here crash the browser | |
// alert("Going That clusters Proxy"); | |
return "PROXY that-clusters.vip.acme.com:1234"; | |
} | |
// URLs within this network are accessed through | |
else if (isInNet(myIpAddress(), "10.0.0.0", "255.255.248.0")) { | |
// should this proxy fail to respond, go directly to the www: | |
return "PROXY intranet-proxy.acme.com:12345; DIRECT"; | |
} | |
else return "DIRECT"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment