Click to See Complete Forum and Search --> : Close window after download


slyndon
07-22-2003, 08:13 AM
I am using the following code to download a database file from my server:

**********
<html>
<head>
<title>Download</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onLoad="MM_goToURL('parent','test.mdb');return document.MM_returnValue">
Downloading ...
</body>
</html>
**********

This works fine. However, I need to make the window close AFTER the download has finished. As it stands the user opens the page and the 'Save' or 'Open' dialogue pops up. They chose and it downloads. Once finished the window needs to close automatically.

I thought about a close on time delay, but this can't be used because the duration of download will depend on file size and modem speed.

Any ideas?

Khalid Ali
07-22-2003, 09:10 AM
It seems like something like this will work

eval(args[i]).onload = function(){
this.close();
}

slyndon
07-22-2003, 10:20 AM
Where do I put this code?