Implement history functions with js