跨域刷新

时间:2011-10-17 16:41:14

标签: javascript cross-domain

我在主机区域设置了一个子域,用于音乐组合。 我的页面在一分钟左右后继续刷新。这非常不方便,因为它是音乐页面,你无法在刷新之前听完整首歌并重新开始。

我注意到我们创建了自动文件。 其中一个是javascript文件,我在Javascript中不太好

文件是这样的:

function SqueereHTTP(url, instance) {
   this.loaded = false;
   this.url=url;
   this.script;
   this.firstparam=true;
   this.serverResponse;
   this.instance=instance;
   that=this;


   this.AddParam = function(p, v) {
      if (that.firstparam) {
         that.url+='?'+p+'='+v;
         that.firstparam=false;
      } else {
         that.url+='&'+p+'='+v;
      }
   }

   this.Request = function(force) {
      that.AddParam('instance', that.instance);
      if (force) {
         var axd = new Date();
         var shake = axd.getDate()+""+axd.getMonth()+1+""+axd.getFullYear()+""+axd.getHours()+""+axd.getMinutes()+""+axd.getSeconds();
         that.AddParam('squeereshaker', shake);
      }
      that.script = document.createElement('script');
      that.script.setAttribute('charset','UTF-8');
      that.script.setAttribute('type','text/javascript');
      that.script.setAttribute('src', that.url);
      that.script.onload = that.onLoad;
      that.script.onreadystatechange = that.onLoad;
      document.getElementsByTagName('head')[0].appendChild(that.script);
   }

   this.onComplete = function(serverResponse) { }

   this.onLoad = function() {
      if (that.loaded) { return; }
      that.loaded=true;
   };

   return this;
}

有没有办法停止刷新周期?

谢谢

0 个答案:

没有答案