anton578 Posted October 9, 2008 Share Posted October 9, 2008 Hi can anyone tell me how to put script on [x] close button that is located in the upper right corner of the window? Link to comment https://forums.phpfreaks.com/topic/127641-putting-script-in-close-button/ Share on other sites More sharing options...
BillyBoB Posted October 9, 2008 Share Posted October 9, 2008 I do believe you can do this but you will have to look into javascript not php because you are talking about the browser if I understand you correctly. PHP is a server side scripting language. Link to comment https://forums.phpfreaks.com/topic/127641-putting-script-in-close-button/#findComment-660514 Share on other sites More sharing options...
dropfaith Posted October 9, 2008 Share Posted October 9, 2008 Yes, you can do it using onbeforeunload event listener. function confirmUnload() { var mes = "Your message here"; if (event) { event.returnValue = mes; } else { // do what? } } window.onbeforeunload = confirmUnload; The first branch is for the standard event handling. I know that Firefox supports this as well by now but in some rather tweaky way and I don't have the workaround snippet handy right now, so for // do what? someone else may help here. Link to comment https://forums.phpfreaks.com/topic/127641-putting-script-in-close-button/#findComment-660524 Share on other sites More sharing options...
dropfaith Posted October 9, 2008 Share Posted October 9, 2008 not sure if thats what your looking for but yes you will need js to do this http://codingforums.com/showthread.php?p=736368 you can look here it might help out Link to comment https://forums.phpfreaks.com/topic/127641-putting-script-in-close-button/#findComment-660526 Share on other sites More sharing options...
anton578 Posted October 9, 2008 Author Share Posted October 9, 2008 Im gonna try that link you gave me. thanks... Link to comment https://forums.phpfreaks.com/topic/127641-putting-script-in-close-button/#findComment-660565 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.