选择最快的服务器

网络通信

  当我们浏览很多大型网站首页时,都会提示让大家选择离自己最近的镜像站点。其实有时候离自己最近的服务器,不一定是速度最快的。下面教大家一招,让你的个人网站自动选择最快的服务器。

  只要在你的站点首页上加入以下JavaScript代码,系统就可以根据程序连接最快的服务器:

  <script>

  var autourl=new Array()

  autourl[1]="http://www.cpcw.com" //镜像站点1

  autourl[2]="http://www.cpcw.com" //镜像站点2

  autourl[3]="http://www.cpcw.com" //镜像站点3

  function yuzi(url){top.location=url}

  for(var i=1;i<autourl.length;i++)document.write("<img src="+autourl[i]+" width=0 height=0 onerror=yuzi('"+autourl[i]+"')>")

  </script>

  loading...<p>请稍候,系统正在为您选择速度最快的服务器……