Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Download file and close window

Posted on 2001-09-13
8
Medium Priority
?
521 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 1

Expert Comment

by:Drewbytes
ID: 6481837
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
ID: 6481995
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 150 total points
ID: 6482371
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
Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

 
LVL 2

Expert Comment

by:kc5sig
ID: 6482444
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
 
LVL 5

Expert Comment

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

0
 
LVL 2

Expert Comment

by:sshhz
ID: 6486427
Formiguinha,

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

it close the opener window.

sshhz
0
 
LVL 2

Expert Comment

by:sshhz
ID: 6486430
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
ID: 6486455
No,

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

Thanks for your helps guys :D
0

Featured Post

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
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 …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

705 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