/    Sign up×
Community /Pin to ProfileBookmark

stop unloading of a window

Hello Folks!

I’m currently stuck in a confusing situation.

On a page there is a form – if the user changed something but instead of submitting the form he leaves the page – i have to prompt him and ask for save.

so far it’s easy.

but if I prompt him using <body onunload=”xxx”> then the site where he wants to go will get a request. the problem is: if he requests “New Entry” – this site will be loaded. Not really loaded, because <body onunload=”xxx”> stops the browser from showing this site, but the PHP script get invoked.

The problem is: this PHP script can delete all entries the user is currently editing.

so i have to stop the script from beeing invoked.
any suggestions?

i know this is hard, and i’m working on it for a several hours but maybe you can help me.

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@khalidali63Feb 21.2003 — It seems a logical error to me,if you post your code here to see the logic of events taking place it should not be

too hard..

cheers

Khalid
×

Success!

Help @Schorny 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.19,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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