Execute a script when a user navigates away from a page in HTML?

HTMLWeb DevelopmentFront End Technology

When the user navigates from a page, the onpagehide attribute triggers. The navigation occurs when a user clicks a link, closes the browser tab, submits a form, etc.

To execute it, try −

<p onpagehide = "myScript">

You can also use,

object.onpagehide = function(){script};
raja
Published on 14-Mar-2018 11:40:01
Advertisements