Home Answers Viewqa Java-Beginners should close the browser with user confirmation in javascript

 
 


K.Senthuran
should close the browser with user confirmation in javascript
2 Answer(s)      4 years and 7 months ago
Posted in : Java Beginners

View Answers

November 5, 2008 at 2:12 PM


Hi
try the following code hope this will help u.if not then again post the problem.

<html>
<head>
<title>Detecting browser close </title>


<script type="text/javascript">

var myclose = false;

function ConfirmClose()
{
if (event.clientY < 0)
{
event.returnValue = 'If You want to close the browser';

setTimeout('myclose=false',100);
myclose=true;
}
}

function HandleOnClose()
{
if (myclose==true)
alert("Browser is closed");
}

</script>
</head>


<body onbeforeunload="ConfirmClose()" onunload="HandleOnClose()">

<h4>Close browser!</h4>

</body>
</html>

November 7, 2008 at 4:47 PM


Hi friend,

<html>
<head>
<title>close window</title>
</head>

<body onbeforeunload="alert('Do you want to close!');">
<h2>This simple close windows Program.</h2>
</body>
</html>


------------------------------------------------------

Thanks.









Related Pages:
should close the browser with user confirmation in javascript - Java Beginners
should close the browser with user confirmation in javascript  Hi, I need to close the browser with the user confirmation. If the user accept olny he/she can close the browser otherwise can't close the browser. How can I do
Closing any kind of browser window without confirmation using javascript
Closing any kind of browser window without confirmation using javascript  Here is my requirement, I have to close a browser window on onload event... help me in resolving this problem. It should support any kind of browser and any
closing the internet explorer window of any version without confirmation using javascript
closing the internet explorer window of any version without confirmation using javascript  Hi all, Here is my requirement, I have to close microsoft internet explorer window on onload event without confirmation. It should
email confirmation - Hibernate
functionality on user registration. My user should reply/click on registration email link after that I should read user data from hibernate/MySql and make some..., than I have to update user but I am not sure how should I select user and finally
problem of confirmation
;" /> </form> Javascript code whcish was given by you
why cant i close this ??
why cant i close this ??  import java.util.Scanner; public class...("Thank you "); } } i should use while to get the square of the number entered by the user
PHP SQL close connection
PHP SQL close connection       PHP SQL close connection is used to close a connection between the PHP... 'PHP SQL close Connection'. To understand and grasp the example we include
Inform user to enable JavaScript
Inform user to enable JavaScript   Hi sir How can we inform user to turn on JavaScript ? Because if we have implemented validation etc... > tag to inform user or run any other code ,when JavaScript is turned off
JFrame Close Box
and ask the user if it should be saved. Or you want to remember the size... Java: JFrame Close Box Terminating the program when the close box... of the window title bar -- minimize, smaller/larger, and close (or whatever
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
Show Confirmation Dialog on Click the Command Link
Show Confirmation Dialog on Click the Command Link  How to show Confirmation Dialog when user Click the Command Link
Java code to executr db query if user directly closes the browser
Java code to executr db query if user directly closes the browser  How to execute a database query if the logged in user idle for 15 mins or he will directly close the browser.........PLS help it out
Closing the browser window
Closing the browser window  <BODY> <form> <input type=button value="Close Window" onClick="javascript:window.close();"> <...; thought that this will close the window of the browser but not working
disabling the browser's back button
disabling the browser's back button  I have following requirement, After submitting the form, user should not navigate to the previous page. I have tried with onbeforeunload(), but it is not working properly. Please help me
Disable offline browser access - Security
solution. What I needed is; When the user clicks the website from the browser history, when the browser is offline, the page should show only the error page...Disable offline browser access    Hi Please help me to solve
Javascript Examples
the user to enter the column number they want to hide.  JavaScript Hide... the user straightforward to the specified URL.  JavaScript move div... World' in order to move it on the browserJavaScript move file
Browser issue
Browser issue  how can i close popup windows in mozilla browser and return back to the parent page
textfield should not allow the user to fill the date in it.
textfield should not allow the user to fill the date in it.  I got a requirement like this, I am dislaying a text field along with a calendar. Here user should not fill the date inside the text field manually. If he tries
Javascript code
which you have come,and the via page At the top of the confirmation page we can see Student Regd->Student Detail->Confirmation..The link should be visible...Javascript code  Thank you a lot for your support throughout
Javascript code
from which you have come,and the via page At the top of the confirmation page we can see Student Regd->Student Detail->Confirmation..The link should...Javascript code  Dear Sir, Thank you a lot for your support
JFrame Close On Button Click
JFrame Close On Button Click In this section we will discuss about how to close frame on click on the button. This example explains you how a frame can be closed on an action event i.e. a frame should be close when clicked
Confirmation Mail
Confirmation Mail  hi, i need the code.when we sign up it will send the confirmation mail to the e-mail right.how to do that part.....and also help me whether the AJAX is better or PHP better for the front design
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
Java Swing Open Browser
Java Swing Open Browser Java provides different methods to develop useful... that will open the specified url on the browser using java swing. This example will really... allowed the user to enter url of their choice. As the user clicked the button
JavaScript - JavaScript Tutorial
interactive user interface design. What is JavaScript? This section... functions via javascript: URLs Conditionally navigating the user to a page... JavaScript Tutorials is one of the best Quick reference to the JavaScript
JavaScript - JavaScript Tutorial
interactive user interface design. What is JavaScript? This section... functions via javascript: URLs Conditionally navigating the user to a page... JavaScript Tutorials is one of the best Quick reference to the JavaScript
how to use confirmation alert box before delete in jsp?
how to use confirmation alert box before delete in jsp?  I use submit button.I want alert box before deleting data.   1)application.jsp... language="javascript"> function deleteRecord(id){ var doIt=confirm('Do you want
JDBC Prepared statement Close
JDBC Prepared statement Close     ... an example from JDBC Prepared Statement Close. In this program, the code describe how... representation  close ( ) :The prepared statement object call close
prevent browser refresh
prevent browser refresh   prevent browser from refresh in Javascript
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
SWT Browser
Browser implements the browser and allows the user to navigate through HTML... SWT Browser       This section shows you SWT Browser In SWT, the class Browser of package
how to capture IE browser FileDownload box open ,save and cancel event - JSP-Servlet
how to capture IE browser FileDownload box open ,save and cancel event  I have a JSP page which allows user to download a file.When user click... stream and did flush and close outputstream object.Beofre that we are setting header
JavaScript - JavaScript Tutorial
(browser). It is also used with the DHTML for creating interactive user interface... functions via javascript: URLs Conditionally navigating the user... where if user select any technology and press.   JavaScript
how can i close a frame. - Java Beginners
how can i close a frame.  Hi, My question is how can we close... should be displayed....this is ok with me..........but iam getting multiple... a new frame should be displayed and old frame should be closed automatically
javascript
javascript  hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using javascript, and when i click on button then number of days should be display in textbox
Browser Back Button click event javascript
Browser Back Button click event javascript  I am using the below code but window.onBeforeUnload is not working with back button.. how can i apply the below code for the click event of back button? window.onBeforeUnload
Updating user profile
Updating user profile  how should i provide user to update his profile with edit option including entered data by user should be shown in jsp page.... When the user clicks the particular edit button, that data will get shown
Javascript
Javascript  in the web form the phonenumber field should be like this format xxx-xxx-xxxx, i want the code in javascript. as a function.   Javascript Phone Number Validation <html> <script> function
How to Collapse Dropdowns on mouseclick on scrollbar in Safari Browser using javascript
How to Collapse Dropdowns on mouseclick on scrollbar in Safari Browser using javascript  How to Collapse Dropdowns on mouseclick on scrollbar in Safari Browser using javascript
Javascript
their roll number.That link should open another pop-up window with name,address field.After saving that edetails,that screeen should automatically be closed, and the existing screen(screen which the link was present) should be refreshed by showing
Resize browser in flex
Resize browser in flex  Hi........ Please tell me about How can I Resize the Internet Explorer browser window from flex ? please give me... with JavaScript in the HTML wrapper: getURL('javascript:window.resizeTo(900,900
should not go back to index.jsp when press on the link logout
should not go back to index.jsp when press on the link logout  Hello... made a index.jsp page in which i m having the two labels user id and password... Logout.java.but now the problem is this ,when i press the back arrow on the browser
should not go back to index.jsp when press on the link logout
should not go back to index.jsp when press on the link logout  Hello... made a index.jsp page in which i m having the two labels user id and password... Logout.java.but now the problem is this ,when i press the back arrow on the browser
should not go back to index.jsp when press on the link logout
should not go back to index.jsp when press on the link logout  Hello... made a index.jsp page in which i m having the two labels user id and password... Logout.java.but now the problem is this ,when i press the back arrow on the browser
Javascript
Javascript  Dear Sir, I want your help urgently.Can please give me the code for selection in the drodown.That means,in the dropdown of items,there are checkboxes woth each item.By which user can select as many items as he/she
The Role of AJAX in enhancing the user experience on the Web
) Rapid user-user communication - browser based chat applications... The Role of AJAX in enhancing the user experience on the Web ( Sagar G..., XMLHttpRequest and Javascript. The acronym AJAX stands for Asynchronous Javascript and XML
Should we go for javascript or applets for online exam project using java
Should we go for javascript or applets for online exam project using java ... soon as the candidate login successfully a window pop up should appear with question and options. This window pop up should accomplish the entire monitor screen
JavaScript Pop Up Boxes
some confirmation is required from  user, it has ok and cancel button. Ok...JavaScript Pop Up Boxes JavaScript has three kind of pop-up boxes,  i)    Alert-Box: If some surety is required from the user
javascript confirm yes no
There is confirm Box popup in JavaScript that can be used to get confirmation from user...javascript confirm yes no  javascript confirm yes no - how to create confirm dialog box yes or no in JavaScript?   if (confirm('Are You
javascript - Ajax
" the jsp page should add the div as "comp2" with the same fields except chargeTo(combo box) so that user can add the details here. pls tell me how it can

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.