Here is the flow I am trying to figure out.
onbeforeunload
and unload
get fired. Here i am getting rid of href in some of my links.Is there any way of knowing if the user clicks a stop button and they are still on the same page?
The only way I can think off the top of my head is to put a setTimeout in the onbeforeunload
or unload
but I don't really like that because there are too many variables for it still being messed up.
What I ended up doing was this:
window.unload = function(){
var _href = $('selector').attr('href');
$('selector').attr('href', '');
setTimeout(function(){
$('selector').attr('href', _href);
}, 1500);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.