/    Sign up×
Community /Pin to ProfileBookmark

Gestione Back Button

ciao a tutti,
ho questo problema:
in una certa pagina del mio sito ho necessità di gestire la chiusura della finestra, il cambio url e il back button. In particolare voglio che:
– per la chiusura finestra e cambio url venga richiamata una funzione che sistema la consistenza (già fatta e funzionante);
– il pulsante di back sia disabilitato oppure capire quando viene premuto per gestirlo diversamente da i due casi sopra.

Ho usato onUnload nel BODY ma non riescoa distinguere i tre eventi

Come posso fare?

Grazie

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@phpnoviceMay 10.2006 — Hello to all, I have this problem: In a certain page of my site I have necessity of to manage the closing of the window, the change url and the back button. Particularly I want that: - For the closing window and change url comes recalled a function that systemizes the consistency (already done and working); - the button of back is disabled or to understand when comes pressed to manage it otherwise from the two cases above.

I used onUnload in the BODY but not riescoa distinguish the three events

How can I do?

Thanks[/QUOTE]

JavaScript cannot "disable" the browser's [Back] button. If there is no navigation history present, then the browser (itself) will disable that button. Furthermore, there is no provided method, in an [b]onunload[/b] event handler, for distinguishing between the different actions which may cause that event to fire. Sorry.
×

Success!

Help @zeccaman 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.18,
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,
)...