bas7320 Posted January 12, 2008 Share Posted January 12, 2008 Is there any way using PHP to have a page display for a set amount of time (say 5 sec.) and then have it automatically close without the need for user interaction? Link to comment https://forums.phpfreaks.com/topic/85681-display-a-page-and-then-automatically-close-it/ Share on other sites More sharing options...
Daukan Posted January 12, 2008 Share Posted January 12, 2008 You can redirect to another page <?php header('Refresh: 5; url=index.html'); ?> Link to comment https://forums.phpfreaks.com/topic/85681-display-a-page-and-then-automatically-close-it/#findComment-437273 Share on other sites More sharing options...
br0ken Posted January 12, 2008 Share Posted January 12, 2008 In the past I've always just used the following piece of Javascript: setTimeOut('window.close()', 5000); The setTimeOut function evaluates the code in the first argument after the amount of time (in miliseconds) has surpassed in the second argument. Link to comment https://forums.phpfreaks.com/topic/85681-display-a-page-and-then-automatically-close-it/#findComment-437279 Share on other sites More sharing options...
Daukan Posted January 12, 2008 Share Posted January 12, 2008 setTimeout() only closes windows that were opened by javascript like a pop up. It can also be disabled. In firefox I get a message something like this: This window is trying to close. Do you want it to 'yes' , 'no' Link to comment https://forums.phpfreaks.com/topic/85681-display-a-page-and-then-automatically-close-it/#findComment-437287 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.