জাভাস্ক্রিপ্টে onpagehide ইভেন্ট তখন ট্রিগার হয় যখন ইউজার পেজ ছাড়ে অন্য পেজে যাওয়ার সিদ্ধান্ত নেয়। এর উদাহরণ: পেজ রিফ্রেশ, লিংক ক্লিক ইত্যাদি।
উদাহরণ
<!DOCTYPE html> <html> <body onpagehide="newFunc()"> <p>Close the page and see what happens!</p> <script> function newFunc() { alert("Thank you!"); } </script> </body> </html>