Unable to redirect to calling page after exporting the cfunction output to excel using cfcontent tag

I’m trying to export the contents of function output to a excel using the click of a button. I have created a action page for the button, which calls the export to excel page using cfheader and cfcontent tag. Exporting the excel using these tags works fine but after the cfcontent tag I have created a form and redirecting it back to the calling page. The code after the cfcontent tag are not executing and page is not redirecting. how should i redirect it after the cfcontent tag? Please help me on the issue.

This is the code I'm using for exporting to excel.

<cfsavecontent variable="strExcelData">

<cfheader name="Content-Disposition" value="attachment; filename=Audit_#DateFormat(Now(),'ddmmyyyy')#.xls"/>
<cfcontent type="application/vnd.msexcel" variable="#ToBinary( ToBase64( strExcelData.Trim() ) )#"/>

<form name=frm_AuditTrail method=POST action=tchk_AuditTrailSearch.cfm>
    <input type='hidden' name='txt_searchstr1' id='txt_searchstr1' value='#FORM.txt_searchstr1#' />
    <input type='hidden' name='txt_searchstr2' id='txt_searchstr2' value='#FORM.txt_searchstr2#' />

<script type="text/javascript">
    window.onload = function()
        alert("windows.onload is redirecting to review data page NOW");


You cannot have any output after a <cfcontent> tag; it is ignored. Only the contents of the <cfcontent> tag are sent back to the browser.

From the docs for cfcontent:

variable  Optional  Name of a ColdFusion binary variable whose contents can be 
                    displayed by the browser, such as the contents of a chart 
                    generated by the cfchart tag or a PDF or Excel file retrieved 
                    by a cffile action="readBinary" tag. When you use this 
                    attribute, any other output on the current CFML page is 
                    ignored; only the contents of the file are sent to the client.

Need Your Help

Binary search in an ordered list in java

java list search binary

Im looking for a way to implement a code in java that works the same way as a binary search in an ordered ArrayList but for an ordered List

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.