Urgent ....... handling close button event of the browser
-
hi all, i am doing a web application project using asp.net 2.0(vb). i need to handle a scenario, when the user clicks on the browser's X button i need to prompt them with a popup message . to handle this i have used the following code --------------------------------------------------------------------------- function HandleOnClose() { if (event.clientY < 0) { event.returnValue = 'Are you sure you want to leave the page?'; } } ----------------------------------------------------------------------------------- it prompts the user with Ok and CANCEL button Message box. when the user click the CANCEL button the page is not closed. But if the user clicks on the OK button the window automatically closed. Instead what i need to do is I have to open a popup window asking the user to fillup a feedback form when the user clicks on the OK button. When the user submits the feedback the page should be closed. can any one tell me how to handle the OK button click event on the above code to achieve my task. Or if u know some other way help me..... thank you all in advance Regards Senthilraj K
-
hi all, i am doing a web application project using asp.net 2.0(vb). i need to handle a scenario, when the user clicks on the browser's X button i need to prompt them with a popup message . to handle this i have used the following code --------------------------------------------------------------------------- function HandleOnClose() { if (event.clientY < 0) { event.returnValue = 'Are you sure you want to leave the page?'; } } ----------------------------------------------------------------------------------- it prompts the user with Ok and CANCEL button Message box. when the user click the CANCEL button the page is not closed. But if the user clicks on the OK button the window automatically closed. Instead what i need to do is I have to open a popup window asking the user to fillup a feedback form when the user clicks on the OK button. When the user submits the feedback the page should be closed. can any one tell me how to handle the OK button click event on the above code to achieve my task. Or if u know some other way help me..... thank you all in advance Regards Senthilraj K
function unloadfun() { if (window.event.clientX < 0 && window.event.clientY < 0) { alert("in"); } } call this method in
Regards, Sylvester G sylvester_g_m@yahoo.com
-
hi all, i am doing a web application project using asp.net 2.0(vb). i need to handle a scenario, when the user clicks on the browser's X button i need to prompt them with a popup message . to handle this i have used the following code --------------------------------------------------------------------------- function HandleOnClose() { if (event.clientY < 0) { event.returnValue = 'Are you sure you want to leave the page?'; } } ----------------------------------------------------------------------------------- it prompts the user with Ok and CANCEL button Message box. when the user click the CANCEL button the page is not closed. But if the user clicks on the OK button the window automatically closed. Instead what i need to do is I have to open a popup window asking the user to fillup a feedback form when the user clicks on the OK button. When the user submits the feedback the page should be closed. can any one tell me how to handle the OK button click event on the above code to achieve my task. Or if u know some other way help me..... thank you all in advance Regards Senthilraj K
Hi Friend i think calling javascript from unload function will have no meaning as you can't do anything as the page is unload event use onbeforeunload event there you have chance Check this code i just tried and it working fine function SomeFunctoin() { here i am checking 2 conditions if(window.event.clientX > 500 && window.event.clientY < 0 || window.event.clientX > 1000 && window.event.clientY < 0) { var bool = confirm("Do you really want to close this window "); if(bool) { // do the things that you want to do if user want to close the window return true; } else { // do the things that when user don't want to close he window return false; } } call this function from lt body onbeforeunload="return SomeFunctoin()"gt -- modified at 4:41 Wednesday 20th June, 2007
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
-
Hi Friend i think calling javascript from unload function will have no meaning as you can't do anything as the page is unload event use onbeforeunload event there you have chance Check this code i just tried and it working fine function SomeFunctoin() { here i am checking 2 conditions if(window.event.clientX > 500 && window.event.clientY < 0 || window.event.clientX > 1000 && window.event.clientY < 0) { var bool = confirm("Do you really want to close this window "); if(bool) { // do the things that you want to do if user want to close the window return true; } else { // do the things that when user don't want to close he window return false; } } call this function from lt body onbeforeunload="return SomeFunctoin()"gt -- modified at 4:41 Wednesday 20th June, 2007
Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "
hi Sandeep , i tried your code.its working finw for the if loop. i.e if(bool) { // do the things that you want to do if user want to close the window return true; } but its not working fine for else part. what i need to do is when they click cancel button in the confirm message box, i need to be in the same page.but the code closes the window for cancel option also. give me the solution. thanks Regards Senthilraj
-
hi Sandeep , i tried your code.its working finw for the if loop. i.e if(bool) { // do the things that you want to do if user want to close the window return true; } but its not working fine for else part. what i need to do is when they click cancel button in the confirm message box, i need to be in the same page.but the code closes the window for cancel option also. give me the solution. thanks Regards Senthilraj
hi all, i implemented the concept. we raised the issue to client and we changed the way of implementing it thanks