/    Sign up×
Community /Pin to ProfileBookmark

control onunload page

Hello,
When an user leaves the page that it is by “press back button” or “quit”, the event “onUnload” is called and I call a server page via a form to pass parameters and that enables me “to kill the session”.

My problem is that if an user submit normally the page with “submit” and well the event “onUnload” is called before the event “onsubmit”.

Any ideas.
my code :
<html>
<head>
<script language=”javascript”>
function send() {
document.valide.submit();
}
function destroy() {
return document.control.submit();
}
</script>
</head>
<h1>TEST</h1>
<BODY onUnload=”destroy()”>

<FORM NAME =”valide” ACTION = “/servlet1” METHOD = “GET” onSubmit = return envoie()>
<input type=”submit” value=”” name=””/>
</form>
<FORM NAME =”control” ACTION = “/servlet2” METHOD = “GET” />
</BODY>
</HTML>

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Mar 07.2003 — just do this set a variable thats set to true when submit button is clicked and the in the destroy function use if statement

if (notTru){

}

hope this helps

Khalid
Copy linkTweet thisAlerts:
@jean-baptisteauthorMar 08.2003 — Thank you, i don't know why i haven't thought of that!
×

Success!

Help @jean-baptiste spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.5,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...