move error page js into script tag