sheriff Posted May 29, 2007 Share Posted May 29, 2007 hi all ... a very beginner question. how can I close a browser window after php read the last row? I have tryed with exit; extit() header("Connection: close"); ... I have no idea... Thanks Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/ Share on other sites More sharing options...
taith Posted May 29, 2007 Share Posted May 29, 2007 javascript... window.close() i believe... Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263821 Share on other sites More sharing options...
sheriff Posted May 29, 2007 Author Share Posted May 29, 2007 i have tryed $close = "javascript:window.close();"; but nothing happend also at the end of the page: <script type="text/javascript"> window.close(); </script> nothing happend Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263823 Share on other sites More sharing options...
taith Posted May 29, 2007 Share Posted May 29, 2007 ... where are you outputing that? storing it in a variable does nothing... Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263825 Share on other sites More sharing options...
sheriff Posted May 29, 2007 Author Share Posted May 29, 2007 first time i store it in a variable, after, i do not. Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263835 Share on other sites More sharing options...
AndyB Posted May 29, 2007 Share Posted May 29, 2007 how can I close a browser window after php read the last row? Maybe this is a dumb question, but why did you open the window in the first place (if only to 'read rows')? And since reading rows all occurs on the server, what's that got to do with closing a window on the client?? Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263838 Share on other sites More sharing options...
sheriff Posted May 29, 2007 Author Share Posted May 29, 2007 ok .. the full story ... I have an add user link, .. this is open in a popup .. I complete the text fields, and i pus submit .. this form jump to an insert_user.php ... and i want to automaticaly close the popup window. thats all. Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263842 Share on other sites More sharing options...
tomfmason Posted May 29, 2007 Share Posted May 29, 2007 just echo the script tags around your js code like this <?php echo "<script>window.close();</script>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263844 Share on other sites More sharing options...
AndyB Posted May 29, 2007 Share Posted May 29, 2007 It's the add user script that should close the window. How about something as simple as using onUnLoad in the add user BODY statement? BODY onUnLoad="javascript:window.close();" Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263846 Share on other sites More sharing options...
chocopi Posted May 29, 2007 Share Posted May 29, 2007 But what happens if the user has javascript disabled ? Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-263874 Share on other sites More sharing options...
AndyB Posted May 29, 2007 Share Posted May 29, 2007 But what happens if the user has javascript disabled ? Nothing - exactly what the user deserves Once again, a design decision that ignores the reality that users do the weirdest things. Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-264252 Share on other sites More sharing options...
per1os Posted May 29, 2007 Share Posted May 29, 2007 But what happens if the user has javascript disabled ? Nothing - exactly what the user deserves Once again, a design decision that ignores the reality that users do the weirdest things. You can always redirect them to a humurous site such as disney.com or something like that as "punishment" for not having javascript enabled. Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-264254 Share on other sites More sharing options...
Daniel0 Posted May 29, 2007 Share Posted May 29, 2007 But what happens if the user has javascript disabled ? Nothing - exactly what the user deserves Once again, a design decision that ignores the reality that users do the weirdest things. You can always redirect them to a humurous site such as disney.com or something like that as "punishment" for not having javascript enabled. And how, may I ask, would you do that without Javascript? Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-264262 Share on other sites More sharing options...
per1os Posted May 29, 2007 Share Posted May 29, 2007 meta redirect ??? Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-264265 Share on other sites More sharing options...
sheriff Posted May 30, 2007 Author Share Posted May 30, 2007 ) ... ok guy's .. the problem is solved <?php echo "<script>window.close();</script>"; ?> Thank you all for helping a noob ! Quote Link to comment https://forums.phpfreaks.com/topic/53397-solved-close-window/#findComment-264455 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.