倒计时后重定向到另一页

时间:2019-11-06 02:34:28

标签: javascript

我有这段代码,我希望在经过10秒的计时器后将用户重定向到另一个页面(test.html)。如果“ if”语句为真,我将如何完成此任务。

case 'disconnect':
  if (connect === 1) {
    $('#terminal').append('<div>C:/root/anon> ' + $(this).val() + '<br><br>Disconnecting...<br>Disconnected<br><br><span id="blinking">_</span></div>');
    disconnect = 1;
    connect = 0;
    minutes = 0;
    seconds = 0;
  } else {
    $('#terminal').append('<div>C:/root/anon> ' + $(this).val() + '<br><br>Failed.<span id="blinking">_</span></div>');
  }
  break;
default:

3 个答案:

答案 0 :(得分:1)

您能尝试一下吗?

var timeleft = 10;
var downloadTimer = setInterval(function(){

  timeleft -= 1;
  if(timeleft <= 0){
    clearInterval(downloadTimer);
    window.location='http://www.google.com';
  }
}, 1000);

答案 1 :(得分:0)

您可以使用setTimeout方法。

例如。

window.setTimeout(function(){
    window.location.href="YOUR ADDRESS HERE";
},10000);

这将在10000ms(10秒)的时间过去之后重定向页面。

答案 2 :(得分:0)

希望添加它对您有用。

ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 filename_here

$ ffprobe data/test/00001/00001.mp4
ffprobe version 4.0.3 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 8.1.0 (GCC)
  configuration: --prefix=/share/pkg.7/ffmpeg/4.0.3/install --enable-gpl --enable-libx264 --enable-hardcoded-tables --enable-pic --enable-shared --enable-lto
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Segmentation fault

相关问题