Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
ASP .Net
Download & Javascript
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Guest, post: 446260"] Hi Marc, I had a similar problem and came across on following solution so see if you can use it. Quote: It closes a popup window once the file save dialog has been closed, etiher by saving the file or clicking cancel, etc. GenerateCSV.asp generates a csv file using Response.ContentType = "text/plain" and Response.AddHeader "content-disposition", "attachment; filename=""" & fileName & """" End Quote This should be your page - page that creates file (download page). First open page with following javascript code - this page will call your download page: <script type="text/javascript"> function getCSV(){ location.href="GenerateCSV.asp"; } function hasFocusBack(){ if(window.focus = true) window.self.close(); setTimeout("hasFocusBack()", 1000); } window.onblur = function(){ hasFocusBack(); } </script> .... <body onLoad="javascript:getCSV();"> The trick is, after download dialog is closed, first window gets focus again, and then it is closed. I tried this on aspx page and it worked. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
ASP .Net
Download & Javascript
Top