[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 380
  • Last Modified:

Refresh Parent Page with CFCONTENT

We open a page with a HREF - <A HREF="mylist.cfm?type=iapr&RequestTimeout=3000" target="_blank">

I run some coldfusion scripts to update the db to reflect the user request - then I need to refresh the parent page before generating the excel file that the user requested.

<script language="javascript">

Open in new window

<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="filename=#filename#.xls">

Open in new window

It isn't refreshing the parent page.  If I do a cfabort, it works just fine.   Is there something else I can do to facilitate this process?
1 Solution
(no points.. )

It can't be done in the same page. With a few exceptions, a page can only contain a single type of content. So your download page can either return an excel file ie "application/msexcel" or "text/html" (ie javascript, css...) . Not both. The cfcontent causes the javascript code to be ignored. That's why it's not firing.

I don't have an example handy, but you could do it with jquery. In the parent page, create a function that calls your download script via ajax. Then in the "success" or "done" function, refresh the current page.

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now