Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



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

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


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



Advertisement
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 Tutorials/Questions & Answers:
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
Advertisements
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
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
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
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
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
How to create a confirmation box?
How to create a confirmation box?  How to create a confirmation box
problem of confirmation
;" /> </form> Javascript code whcish was given by you
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
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
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
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 User Defined Functions
JavaScript User-Defined Functions: An user-defined function saves  us... them to work. JavaScript has so many built-in functions, besides  that you can make your own as per the need. General structure of the user defined
browser
browser  how to make a browser
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
How to disable back button in browser using javascript
in browser. Most common example of this is found in Online Banking Websites. Most of the time the back button is disabled because a user can hit back... that will disable the working of Back button in Browser: <SCRIPT type="
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
browser
browser  hello this is saurav srivastav, thank you for sending the cvode for creating the menu item, but I want the code for file open and save frame in the swing because I am working on my project Browser and one more problem
how to send smtp mail to entered user mail id after user registered using javascript?
how to send smtp mail to entered user mail id after user registered using javascript?  how to send smtp mail to entered user mail id after user registered using javascript
how to send smtp mail to entered user mail id after user registered using javascript?
how to send smtp mail to entered user mail id after user registered using javascript?  how to send smtp mail to entered user mail id after user registered using javascript
need solution to get file name from path which should give by user
need solution to get file name from path which should give by user  how do i write a program in java that i should get file path from arguments.currently this code creates the file at d:\ but i need to get this file name
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
I have a tex box. in that i want user should enter data in the format specified(for eg--a_b_c_d_e_)how to write code for it.
I have a tex box. in that i want user should enter data in the format specified(for eg--a_b_c_d_e_)how to write code for it.  I have a tex box. in that i want user should enter data in the format specified(for eg--abcde_)how
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
Browser issue
Browser issue  how can i close popup windows in mozilla browser and return back to the parent page
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
Calling In JavaScript Functions from HTML Form To Validate User Entered Data
Calling In JavaScript Functions from HTML Form To Validate User Entered... and editing my html to call my functions to validate the user entered data...;title>Subscription Form</title> <script type="text/javascript">
how to close JSF application..?
how to close JSF application..?  how to close jsf appliaction using command button with help of java code
Need runescape 2007 gold but hate phone confirmation?
Need runescape 2007 gold but hate phone confirmation?  Do you think it is really boring to be confirmed when buying runescape 2007 gold pay by paypal... any confirmation pay by paypal. 6% discount code for you: PPSALE
Advertisements
 

 

 

DMCA.com