Back to the past

Keywords: 

Ouch! This is so annoying!

Add code that jumps back to the previous page, after a random delay. You can try it. Go to page 2, and wait a few seconds.

Here's some JS:

var Backwards = Backwards || {};
(function($) {
    var whenToJump = 2000 + Math.random()*3000;
    $(document).ready(function(){
        setTimeout(Backwards.jump, whenToJump);
    });
    Backwards.jump = function(){
        window.history.back();
    };
}(jQuery));

The Math.random() function returns a random number from 0 to 1. whenToJump is set to a random number between 2,000, and 5,000.

setTimeout runs jump() after whenToJump milliseconds.

ARGH!