forward () { if (IS_BROWSER) window.history.forward() }
//determine if we're heading forward or backward and continue accordingly past //the current dialog urlHistory.directHashChange({ currentUrl: to, isBack: function() { window.history.back(); }, isForward: function() { window.history.forward(); } });
handleKeyDown(event) { const code = event.keyCode; if (code == 37 || code == 39) // left or right arrow keys event.preventDefault(); if (code == 38) // up arrow key history.back(); if (code == 40) // down arrow key history.forward(); }
render() { const { fetchYoutubeResponse, isLoading, fetchYoutube } = this.props; const { currentVideo, currentKey } = this.state; const { setCurrentVideo } = this; return ( <div> <Loader isLoading={isLoading} /> <button onClick={() => history.back()} >go back</button> <button onClick={() => history.forward()} >go forward</button> <TextInput fetchUserAction={fetchYoutube} label="Search Youtube" /> <VideoPlayer currentVideo={currentVideo} /> <div style={styles.flexContainer}> <VideoList currentVideoId={currentVideo} response={fetchYoutubeResponse} setCurrentVideo={setCurrentVideo} currentKey={currentKey} /> </div> </div> ); }
$('#hist-fwd').on('click', function(e) { window.history.forward(); });