Add history handler:before and handler:after events