No download from link, when pg opened via window.showModalDialog( )

J

John

Hi,

I'm having a problem opening / downloading csv files when called from a page
opened with window.showModalDialog( ).

To isolate this problem, I've written 3 files (see below).
1. main.htm allows the user to open the page containing the link in a
regular window or one opened via window.showModalDialog( )
2. modal.htm provides a link to the aspx which generates the csv
3. csv.aspx generates a csv file

When I open modal.htm with window.showModalDialog( ), clicking the link does
nothing.
When opened in a normal window, clicking the link opens / downloads the
generated csv.

Does anybody know away around this?

I would like to keep the modal window.

Thanks in advance,
John

------------------------------------------------------------
-- main.htm
------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<script language="javascript">
function openModalDlg()
{
window.showModalDialog( "modal.htm", "",
"dialogHeight:200px;dialogWidth:400px;");
}
</script>
</head>
<body>
<p>
Click <a href="#" onclick="openModalDlg();">here</a> to open modal dialog
</p>
<p>
Click <a href="modal.htm" target="_blank">here</a> to open in regular
window
</p>
</body>
</html>

------------------------------------------------------------
-- modal.htm
------------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<base target="_self">
</head>
<body>
<p>
Click <a href="csv.aspx">here</a> to generate csv file from this page.
</p>
<p>
<button onclick="window.close();">Close</button>
</p>
</body>
</html>

------------------------------------------------------------
-- csv.aspx
------------------------------------------------------------
<%
// set export header
Response.ContentType = "Application/x-msexcel";
Response.AddHeader("content-disposition",
"attachment;filename=test.csv");

Response.Write( "\"Col A\",\"Col B\",\"Col C\"");
Response.Write( Environment.NewLine);
Response.Write( "1,2,3");
Response.Write( Environment.NewLine);
Response.Write( "4,5,6");
Response.Write( Environment.NewLine);
Response.Write( "7,8,9");
Response.Write( Environment.NewLine);
Response.End();
%>
 
J

John

John said:
Hi,

I'm having a problem opening / downloading csv files when called from a
page opened with window.showModalDialog( ).

To isolate this problem, I've written 3 files (see below).
1. main.htm allows the user to open the page containing the link in a
regular window or one opened via window.showModalDialog( )
2. modal.htm provides a link to the aspx which generates the csv
3. csv.aspx generates a csv file

When I open modal.htm with window.showModalDialog( ), clicking the link
does nothing.
When opened in a normal window, clicking the link opens / downloads the
generated csv.
.....


Just an FYI for future reference.

This problem was resolved comp.lang.javascript
http://groups.google.com/group/comp...9c78cb8f52/26e91e2bf88c4034?#26e91e2bf88c4034

Regards,
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top