How can we do JavaScript object detection for pageShow and pageHide handlers?
if( /* pagehide is supported */ ){
window.addEventListener('pagehide', exitFunction, false);
}
else{
window.addEventListener('unload', exitFunction, false);
}
if ('onpagehide' in window) {
window.addEventListener('pagehide', exitFunction, false);
} else {
window.addEventListener('unload', exitFunction, false);
}