What javascript error?
This is how I have done it in the past, with no errors:
byte[] fileData =(byte[])ds.Tables[0].Rows[0][3];
HttpContext context = HttpContext.Current;
context.Response.Clear();
context.Response.ClearContent();
context.Response.ClearHeaders();
context.Response.Buffer = true;
context.Response.ContentType = ds.Tables[0].Rows[0][4].ToString() ;
context.Response.AppendHeader("Content-Disposition", "attachment; filename=1.xls");
context.Response.AppendHeader("content-length", filedata.Length.ToString());
context.Response.BinaryWrite(filedata);
context.Response.Flush();
context.Response.End();
(Looking at it now, I think the ClearContent and ClearHeaders might be redundant after the Clear. :-p )