First, open this page in a new window or tab, to clear any current window or tab history. Make your window wide enough so that you can see the full URL in the address bar, with some extra space left over.

Add ten history entries

Go back 10 times

Notes

The code


var delay = 250;

// Set the browser title.
function set_title( i ) {
  document.title = document.title.replace( /\s*\d*$/, '' ) + ' ' + i;
}

// Add new history entries by changing window.location.hash, in an
// asynchronous loop.
function add_history_entries( start, end ) {
  (function loopy(){
    window.location.hash = '#' + start;
    set_title( start );
    ++start <= end && setTimeout( loopy, delay );
  })();
};

// Go back in the history, in an asynchronous loop.
function go_back( i ) {
  (function loopy(){
    window.history.go(-1);
    --i && setTimeout( loopy, delay );
  })();
};

// Some window.onhashchange stuff. Not really important here.
function handler() {
  var i = window.location.hash.replace( /^#/, '' );
  set_title( i );
};

if ( window.addEventListener ) {
  window.addEventListener( 'hashchange', handler, false );
} else if ( window.attachEvent ) {
  window.attachEvent( 'onhashchange', handler );
}