/    Sign up×
Community /Pin to ProfileBookmark

Close window after download

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?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliJul 22.2003 — It seems like something like this will work

eval(args[i]).onload = function(){

this.close();

}
Copy linkTweet thisAlerts:
@slyndonauthorJul 22.2003 — Where do I put this code?
×

Success!

Help @slyndon spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...