use header of JS to redirect to error page