
open = function( path, state ){
    history.pushState( state, '', path );
  };

window.onpopstate = function( event ){
  console.log( 'state: ' + JSON.stringify( event.state ) );
}

let mystate = { foo: "bar" };

open( "/foo", mystate );