Skip to content

Instantly share code, notes, and snippets.

@nightlyworker
Forked from richorama/index.html
Last active August 29, 2015 14:09
Show Gist options
  • Save nightlyworker/d3c064dda4fc7fa709d7 to your computer and use it in GitHub Desktop.
Save nightlyworker/d3c064dda4fc7fa709d7 to your computer and use it in GitHub Desktop.
<html>
<head>
<script>
var locations = {
"speedtestwe": "West Europe",
"speedtestsea" : "Southeast Asia",
"speedtestea": "East Asia",
"speedtestnsus": "North Central US",
"speedtestne": "North Europe",
"speedtestscus": "South Central US",
"speedtestwus": "West US",
"speedtesteus": "East US",
"speedtestjpe": "Japan East",
"speedtestjpw": "Japan West"
};
var i = 1;
// This function is called when each Data Center responds.
// The first to respond is the nearest!
function call(name){
console.log(i + ":" + locations[name]);
i++;
}
for(var name in locations){
append(name);
}
function append(name){
var head = document.getElementsByTagName("head")[0];
var newscrpt;
newscrpt = document.createElement('script');
newscrpt.type = "text/javascript" ;
newscrpt.src = "//" + name + ".blob.core.windows.net/cb.json";
newscrpt = head.appendChild(newscrpt);
}
</script>
</head>
<body>Results are in the console</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment