Document beforeRedirect callback