You can't do this with client-side JavaScript, you need to set the response header...
.NET
Response.AddHeader("Content-Disposition", "inline;filename=filename.xls")
Or PHP
$filename = 'somehting.xls';
header('Content-Disposition: attachment; filename="'.$filename.'"');