Jump to content

Redirect: not header redirect


xProteuSx

Recommended Posts

sleep(5);
header('Location: somewhere');
exit();

without using the header funciton

 

Yes, but the poster's reason was:

The reason that I don't want to use a header, is that I need the page to actually display for a few seconds before the redirect takes place.  I've never heard of a time delay on a header redirect ...

 

So I showed the time delay.  :P

Link to comment
Share on other sites

sleep(5);
header('Location: somewhere');
exit();

without using the header funciton

 

Yes, but the poster's reason was:

The reason that I don't want to use a header, is that I need the page to actually display for a few seconds before the redirect takes place.  I've never heard of a time delay on a header redirect ...

 

So I showed the time delay.  :P

lol.. very true my friend.. guess its one of those days.. ::)

Link to comment
Share on other sites

header("refresh: 5; yourpage.php");

Refresh is not a standard HTTP header. There's no guarantee that'll work.

 

sleep(5);
header('Location: somewhere');
exit();

That won't work at all.

 


The best solution posted yet, though there's also JavaScript to consider.

window.setTimeout(function() { document.location = "http://www.yourdomain.com/index.html"; }, 5000);

Link to comment
Share on other sites

sleep(5);
header('Location: somewhere');
exit();

That won't work at all.

 

Really?  How so?

 

Well obviously it works as posted, but not with output before.  My bad.  :wtf:

yes abra this is why I questioned your post previously.. I am assuming that the OP has a good amount of code coming before this procedure and is confused on how to go about this.. then again for something like this.. the header can most likely, and probably should go at the top of the code.. since the OP will want to re-direct the visitor immediately

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.