robert_gsfame Posted February 23, 2011 Share Posted February 23, 2011 how can i show an alert message once [x] button on the titlebar of the browser being clicked. I try so many codes but didn't work at all thx in advance Link to comment https://forums.phpfreaks.com/topic/228565-alert-once-browser-window-closed/ Share on other sites More sharing options...
denno020 Posted February 23, 2011 Share Posted February 23, 2011 <html> 02. <head> 03. <script type="text/JavaScript"> 04. function ExitPage() 05. { 06. alert ('Before You Leave:\n\nPlease Check our new tutorials on <a class="linkifierplus" href="http://www.mistonline.in.\n\nMore">http://www.mistonline.in.\n\nMore</a> than 250 tutorials.\n\nPlease submit your own tutorials for free\n\nA complete reference for webmasters!!!!!.'); 07. getit() 08. } 09. function getit() { 10. askit = confirm("Leaving so soon? Why not stay a little longer!"); 11. if (askit == true) 12. alert('Thanks'); 13. else 14. if (askit == false) 15. alert("Visit again soon!"); 16. } 17. </script> 18. </head> 19. <body onbeforeunload="ExitPage();"> Found this code on http://www.tutorialized.com/view/tutorial/Alert-a-message-before-leaving-a-web-page-using-javascript/65638. Denno Link to comment https://forums.phpfreaks.com/topic/228565-alert-once-browser-window-closed/#findComment-1178517 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.