यदि आप दस्तावेज़ लोड होने से पहले किसी ईवेंट को ट्रिगर करना चाहते हैं, तो अनलोड करने से पहले . का उपयोग करें घटना।
उदाहरण
जावास्क्रिप्ट में ऑन बिफोर अनलोड इवेंट को कैसे लागू किया जाए, यह जानने के लिए आप निम्नलिखित कोड को चलाने का प्रयास कर सकते हैं।
<!DOCTYPE html>
<html>
<body onbeforeunload="return myFunction()">
<a href="https://www.qries.com">Click to open Qries</a>
<script>
function myFunction() {
return "Working with onbeforeunload event";
}
</script>
</body>
</html>