473,473 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to close a javascript window when asp script end

i open the file download.asp from another main.asp page using
window.open
what the problem is when i clikc on the hyperlink it prompts me the
ie save dialog box
taht fine.
but when the script ends in download.asp i wanna close the
download.asp .asp window open in background..
but that not working.
how to close the window download.asp as i wanna save the content in
text format i dont wnat to use the body unload event handler as the
html tags will be printed in the text file
guys give yr inputs i am stuick in this..


function downloadWIN( windowURL ) {
return window.open( windowURL,'download',
'width=10,scrollbars=0,height=10,toolbar=0,locatio n=0,directories=0,status=0,menuBar=0,screenX=50,sc reenY=50,left=50,top=50'
) }

<td ><a href="#" onclick="javascript:downloadWIN( "download.asp")">
download sample</font></a>

</td>
</tr>

here my file download.asp

<%
dim StrFileName
StrFileName="a.txt"
Response.ContentType = "text/plain" 'Content Type For File Download
in Csv Format
Response.AddHeader "content-disposition","attachment; filename=" &
StrFileName 'Prompt the user For File Download
Response.Buffer=true
Response.Write "hi"
%>
<script>
self.close()
</script>
Jul 19 '05 #1
1 5235
If you're forcing a download, why are you doing a window.open?

Ray at work

"Navin" <na******@rediffmail.com> wrote in message
news:5d**************************@posting.google.c om...
i open the file download.asp from another main.asp page using
window.open
what the problem is when i clikc on the hyperlink it prompts me the


function downloadWIN( windowURL ) {
return window.open( windowURL,'download',
'width=10,scrollbars=0,height=10,toolbar=0,locatio n=0,directories=0,status=0
,menuBar=0,screenX=50,screenY=50,left=50,top=50' ) }

<td ><a href="#" onclick="javascript:downloadWIN( "download.asp")">
download sample</font></a>

</td>
</tr>

here my file download.asp

<%
dim StrFileName
StrFileName="a.txt"
Response.ContentType = "text/plain" 'Content Type For File Download
in Csv Format
Response.AddHeader "content-disposition","attachment; filename=" &
StrFileName 'Prompt the user For File Download
Response.Buffer=true
Response.Write "hi"
%>
<script>
self.close()
</script>

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon Fletcher | last post by:
Hello there, I need a "Close Window" script ( onLoad.Close.Window() ), however i need the script so it don't come up with this annoying window: "This window is trying to close" window. Is...
2
by: Irvin Amoraal | last post by:
Process: I have a form which uploads a file from client to server written in PHP. When the user presses the submit button, I use the "onSubmit" event to execute javascript to open a child window...
4
by: ...D. | last post by:
OK. I am halfway decent with HTML. Now I want to try javascript for some things that HTML cannot do. I have looked over a tutorial & all. What I want to do is create a button, that when...
6
by: marcelf3 | last post by:
Hello.. This page opens a window with some information, but everytime the user changes a field in the parent window, the child window needs to be closed. These 2 functions were supposed to do the...
4
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen...
14
by: Paul | last post by:
Hi I have 2 functions in java script, one opens a second window-this works, the other is supposed to close this second window, does not seem to be working. Just wondering if anyone had any ideas....
9
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" +...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
2
by: kurt sune | last post by:
Hello, I have a weird problem, I hope someone can explain this for me. I have a webpage using masterpage. In it I create a popup window using this code: Dim js As String = "<script...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am looking for a java script to close a web form that I can attatch to a button click event. I am using vs2005, c#. Thanks -- Paul G Software engineer.
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.