How to detect browser support for pageShow and pageHide?
How can we do JavaScript object detection for pageShow and pageHide handlers?
if( /* pagehide is support开发者_如何学JAVAed */ ){
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);
}
精彩评论