In order to redirect to a different page, do the following:
if(//condition here){ window.location.href = "[your link]"; } else{ alert("Fulfill the condition here"); }