By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,472 Members | 1,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,472 IT Pros & Developers. It's quick & easy.

Close the Browser with Javascript

P: 7
Can you help me out to close browser using asp code? I don't want to click on any link . I have page1.asp, from where i am opening a pop-up window (page2.asp) which has a form having some fields.
I want to fill the form and after clicking on submit button, it is redirected to other page and at that time, i want to close the pop-up. there must be no link to close the window.
Dec 6 '05 #1
Share this Question
Share on Google+
4 Replies

Expert Mod 100+
P: 2,330
You will need to use javascript, and on-submit i think close the page. I will see if i can scour up some sample code for you.
Dec 6 '05 #2

Expert Mod 100+
P: 2,330
Here is some html/javascript code

Expand|Select|Wrap|Line Numbers
  2. <form method="POST" action="samplepage.asp" onsubmit="window.close();">
  3.      <--- FORM FIELDS/OPTIONS GO HERE ---->
  4. </form>
Dec 6 '05 #3

P: 7
Thanks for helping, but there is a problem, the page which i want to close, calls a java script function when submit button is clicked, so how to write window.close(); in that function.
Through java script function, i submitted the form.
Dec 6 '05 #4

Expert Mod 15k+
P: 16,027
Closing the window onsubmit would close the window before the form has been fully submitted. What should be done in this case is to close the window on body load in the action page, e.g.
[html]<body onload="window.close();">[/html]
Jun 22 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.