Link to home
Start Free TrialLog in
Avatar of drmans
drmans

asked on

prompt user to save asp page as .txt file

I have created a javascript function which would loop through the contents of a table and output the contents as essentially a text csv file which then displays on the browser in the same page.  In other words this function replaces the original display with the new text and displays that to the user.  I'm unsure how to structure the code so that it writes the data into a new tab or page in the browser rather than overwrites the original.  I also need to then prompt the user to download the created page and save as a .txt file.  I'm assuming this process would require asp code but since asp executes prior to javascript I'm not sure how to integrate the two.  Any help is greatly appreciated.
Avatar of Ramanhp
Ramanhp
Flag of India image

you may incorporate alert function at the end of ur javascript

eg:  alert("Please save the new created page in a text file");

Avatar of drmans
drmans

ASKER

I thought about that option but ideally the script would AUTOMATICALLY force a download dialog box.  I've seen it done via asp headers but there would need to be a way to execute the asp code AFTER the javascript has finished executing which I don't think is possible?  
Avatar of drmans

ASKER

Let me rephrase the question to simplify a bit...

How would you go about forcing a download dialog box on a dynamically created page?
Ultimately I would like to use some asp code to simply 'copy' the text displayed and offer the user a 'save as' box so that the user doesn't need to right click and save as manually.
ASKER CERTIFIED SOLUTION
Avatar of Ramanhp
Ramanhp
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial