HTML onpagehide attribute

HTML onpagehide attribute: This attribute occurs when the user is redirecting away from a webpage. The onpagehide event is frequently used instead of the onunload event, as the onunload event causes the page is not being cached.

HTML onpagehide attribute

This attribute supports the <body> element.

Syntax: <body onpagehide=”script”>


<!DOCTYPE html>
        <title>Freshersnow onpagehide Attribute</title>
    <body onpagehide="onPageHide()">
        <h1><Freshersnow onpagehide Attribute></h1>    
            function onPageHide() {
                alert ("Thank you, Please Visit again.");