Skip to content

Instantly share code, notes, and snippets.

@ssimpson89
Forked from Kapeli/cdn.js
Created February 25, 2014 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssimpson89/9219797 to your computer and use it in GitHub Desktop.
Save ssimpson89/9219797 to your computer and use it in GitHub Desktop.
function latencyTest(url) {
$.ajax({
url: "http://"+url+".kapeli.com/feeds/latencyTest_v2.txt",
cache: false,
success: function(content){
if(beginsWith("Just a latency test. Move along.", content))
{
var link = document.getElementsByClassName("downloadButton")[0];
if(link.getAttribute("href") == "Dash.zip")
{
link.href = "http://"+url+".kapeli.com/Dash.zip";
}
}
}
});
}
$(window).load(function() {
latencyTest('london');
latencyTest('london2');
latencyTest('newyork');
latencyTest('dallas');
latencyTest('sanfrancisco');
latencyTest('tokyo');
latencyTest('sydney');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment