Javascript window events
Onbeforeunload function in javascript
When you have filled up a form in a web page and if you close the page before submitting itYou may get a message " Are you sure to leave this page?" Such customized messages are examples of window events onbeforeunload
onbeforeunload event is fired when the document unloads its resources. You may notice the document is still visible and the event can be cancelled. onbeforeunload event is assigned to the <body> element.
Various mobile user agents ignore the event.
Subscribe to Creative Technocrayts and be a part of growing community.
HTML code:
<body onbeforeunload="return myFunction()">
Other tags
</body>
SCRIPT code:
function myFunction(){
return "Your message goes here"
}
UI practice series
Input range slider UI and populating the value
Feel free to share your feedback / queries and Subscribe to Creative Technocrayts and be a part of growing community.
Fb link : @CreativeTechnocrayts
Comments
Post a Comment