Check origin before redirecting users with default JS.