Solved

Download file and close window

Posted on 2001-09-13
8
486 Views
Last Modified: 2013-12-24
Hi all,

I have a link that when user click it, it will pop up a new window that executes CF code and the user will have options to download the file (the default window that says you want to open it or save it to the disk).

My problem is when I choose neither ok or cancel to that download options, the pop window won't close and it just blank.

I put this script in my pop up window.

<script>
  self.location = 'file1.exe';
  self.close();
</script>

the problem is it just close and won't show up the download window.

Is there anyway to close that popup window immediately after the download window show up ???

Thanks.
0
Comment
Question by:Formiguinha
8 Comments
 
LVL 1

Expert Comment

by:Drewbytes
Comment Utility
Try window.close(); instead.

I have used this before in similiar situations and it does close the popup window after doing something in the main window.
0
 

Author Comment

by:Formiguinha
Comment Utility
Hi,

I try it. Still doesn't work. I think the problem is I put the self.close() or window.close() after self.location() so it won't execute the self.location() at all but just close the window without showing any download dialog at all.

What I'm going to do is I show up the download dialog and close the html window open after I choose ok to save it to the disk or open it from current location.

Any suggestion ??
0
 
LVL 2

Accepted Solution

by:
sshhz earned 50 total points
Comment Utility
Formiguinha,

I ve a suggestion. Assume user clicks on the page call download.cfm (a listing of files to download). Then when they click the link of the file, or you can provide an image to represent download, once they click this ... straight away call File Download window, asking "What would you like to do with this file?" Either you "open this file from its current location" or "save this file to disk" .... then you need not have to worry whether you want to close the pop up new window for it.

sshhz

0
 
LVL 2

Expert Comment

by:kc5sig
Comment Utility
You're moving the location of the window, so your "close" won't work.

What you might want to try is opening a pop-up that points to the file and then closing the caller.  See if that works.

HTH
Hatton Humphrey
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 5

Expert Comment

by:Yog
Comment Utility
<script>
 self.location = 'file1.exe';
 opener.window.location.href="pagethatopenedpopup.cfm"
 window.close();
</script>

0
 
LVL 2

Expert Comment

by:sshhz
Comment Utility
Formiguinha,

<SCRIPT>
 window.opener.close();
</SCRIPT>

it close the opener window.

sshhz
0
 
LVL 2

Expert Comment

by:sshhz
Comment Utility
Formiguinha,

Thanks for credits. I didn't know you've chosen my comment as answers as i posted another script to close the opener window. Anyway, thanks again.

sshhz
0
 

Author Comment

by:Formiguinha
Comment Utility
No,

I try the yog script but the idea is from you.

Thanks for your helps guys :D
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now