Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

cfcontent and close page

New Here ,
Feb 07, 2009 Feb 07, 2009
Hi,

When I want to download a document, I use the cftag cfcontent ...
My problem is this one : when the document is open, I would like to close the windows that open the document with cfcontent.

I have try many thinks, but nothing work !

1) <script>window.close()</script>
2) <BODY onLoad="setTimeout(window.close, 30000)">

Code :

<html>
<head>
<title>test</title>
<cfheader name="Content-Disposition" value="attachment; filename=#doc_p#">

<cfswitch expression="#type_doc#">
<cfcase value="doc"><cfset type_p = "application/msword"></cfcase>
<cfcase value="xls"><cfset type_p = "application/msexcel"></cfcase>
<cfcase value="pdf"><cfset type_p = "application/pdf"></cfcase>
<cfcase value="rtf"><cfset type_p = "application/rtf"></cfcase>
<cfcase value="txt"><cfset type_p = "text/plain"></cfcase>
<cfcase value="gif"><cfset type_p = "image/gif"></cfcase>
<cfcase value="jpg"><cfset type_p = "image/jpeg"></cfcase>
<cfcase value="tml"><cfset type_p = "text/html"></cfcase>
<cfcase value="html"><cfset type_p = "text/html"></cfcase>
<cfcase value="htm"><cfset type_p = "text/html"></cfcase>
<cfdefaultcase>
<cfset type_p = "Application/Unknown">
</cfdefaultcase>
</cfswitch>

<cfswitch expression="#type_doc2#">
<cfcase value="docx"><cfset type_p = "application/msword"></cfcase>
<cfcase value="xlsx"><cfset type_p = "application/msexcel"></cfcase>
</cfswitch>
</head>
<body>
<cfcontent file="#chemin_fichier#documents\#dir_p#\#doc_p#" type="#type_p#">

<script>
window.close();
</script>

</body>
</html>



If somebody have a solution.

Thanks you.

Dave
TOPICS
Advanced techniques
481
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 11, 2009 Feb 11, 2009
LATEST
dave_75 wrote:
> Hi,
>
> When I want to download a document, I use the cftag cfcontent ...
> My problem is this one : when the document is open, I would like to close the
> windows that open the document with cfcontent.

Open the document in a new window. The browser will close the window
automatically if the user is downloading the file.

--
Mack
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources