ballouta Posted November 4, 2008 Share Posted November 4, 2008 hello I have a button 'add to cart', when somone presses on it, i want to open the add2cart.php page in a new window (small one and un resizable if possible) and make some DB process then let this page closees automatically. is this possible? thank you Quote Link to comment https://forums.phpfreaks.com/topic/131391-solved-automatically-close-window/ Share on other sites More sharing options...
F1Fan Posted November 4, 2008 Share Posted November 4, 2008 Echo the JavaScript code "window.close();" and it will work (assuming the user doesn't have JS disabled). Quote Link to comment https://forums.phpfreaks.com/topic/131391-solved-automatically-close-window/#findComment-682344 Share on other sites More sharing options...
Riparian Posted November 5, 2008 Share Posted November 5, 2008 This is what I use at the end of the processing <SCRIPT LANGUAGE="JavaScript"> <!--hide window.close(); //--> </SCRIPT> Quote Link to comment https://forums.phpfreaks.com/topic/131391-solved-automatically-close-window/#findComment-682578 Share on other sites More sharing options...
F1Fan Posted November 5, 2008 Share Posted November 5, 2008 Please be as clear as possible. Are you saying that this is what you are currently using and it's not working? If so, do this: <script type="text/javascript" language="javascript"> window.close(); </script> Keep in mind, this will not work if the user has disabled JS. Quote Link to comment https://forums.phpfreaks.com/topic/131391-solved-automatically-close-window/#findComment-682601 Share on other sites More sharing options...
Adam Posted November 5, 2008 Share Posted November 5, 2008 To cater for those without JS you could use: <script type="text/javascript" language="javascript"> window.close(); </script> <noscript>You may now close this page.</noscript> Quote Link to comment https://forums.phpfreaks.com/topic/131391-solved-automatically-close-window/#findComment-682823 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.