daydreamer Posted September 21, 2008 Share Posted September 21, 2008 On a site I am making a user inputs details, submits them and then I do some processing via php. Problem is processing takes about 5-10 seconds. this is a long time for a user to be waiting looking at the same page not being able to do anything. So, can i redirect them to another useful page of my site, while i process the information they gave me on the server? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 You could add a div that covers the whole page onunload (javascript) on your submitting page. If it's the second page, have it display by default at first, then add an onload function that removes it when the page is done loading. Quote Link to comment Share on other sites More sharing options...
DamienRoche Posted September 22, 2008 Share Posted September 22, 2008 Why go to all that trouble for 10 seconds? I'd just have a nice animated gif ...processing.... so they can see something's happening. Only other thing I can think of is do what F1Fan said, use a bit of javascript to pop-up a nice overlaying div, keep 'em entertained. Seriously though, are your visitors that edgy? Quote Link to comment Share on other sites More sharing options...
F1Fan Posted September 22, 2008 Share Posted September 22, 2008 Here's some code that I use throughout my sites: <script type="text/javascript"> function pleaseWait(){ document.getElementById('pleasewait').style.display = "none"; } </script> <body onload="pleaseWait();"> <table width="100%" height="100%" bgcolor="#FFFFFF" id="pleasewait" style="display:block;z-index:2;position:absolute;left:0px;top:52px;"> <tr height="225"> <td width="100%" colspan="3"> </td> </tr> <tr> <td width="49%"> </td> <td align="center" valign="middle" width="2%" nowrap> Please wait...<br> <image src="images/pleasewait.gif"> </td> <td width="49%"> </td> </tr> </table> <!-- rest of your body here --> This code can be easily modified to work on unload. Just replace "onload" with "onunload," document.getElementById('pleasewait').style.display = "none"; with document.getElementById('pleasewait').style.display = "block"; and <table width="100%" height="100%" bgcolor="#FFFFFF" id="pleasewait" style="display:block;z-index:2;position:absolute;left:0px;top:52px;"> with <table width="100%" height="100%" bgcolor="#FFFFFF" id="pleasewait" style="display:none;z-index:2;position:absolute;left:0px;top:52px;"> Quote Link to comment Share on other sites More sharing options...
daydreamer Posted September 23, 2008 Author Share Posted September 23, 2008 Thanks F1Fan, ill probably end up doing something like that. Damien, i dunno if my visitors will be edgy! , but the main reason i want to send them to another page is to have the whole browsing experience on the site fast. nobody likes to wait. cheers. Quote Link to comment 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.