|
|
|
|
![]() ![]() |
Jan 6 2006, 08:26 PM
Post
#1
|
|
|
Newbie [Level 1] ![]() Group: Members Posts: 17 Joined: 6-January 06 Member No.: 16,687 |
hey ppl, i just wanted a little help...i designed this website, but i want that if i click on certain link, it should open new page for few seconds and then browser should automatically redirect me to some other page....i tried this with header() function but i couldnt do the wait n redirect part, ...
so somebody plz help.... -thanx in advance! This post has been edited by jlhaslip: Jan 6 2006, 11:18 PM |
|
|
|
Jan 6 2006, 10:55 PM
Post
#2
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 630 Joined: 12-August 05 From: Melbourne, Australia Member No.: 10,624 |
The simplest way to do this is to use a <META> tag in between the <HEAD> tags of your document. Here's an example...
CODE <meta http-equiv="refresh" content="5;url=http://www.mysite.com/nextpage.html"> The value for 'content' is the time in seconds that want the original page to be displayed, the example shows 5 seconds. The value for 'url' is the page you want to redirect to. Hope that helps. [END NOTE] When posting your topics you should try to make your subject more descriptive. A better topic for this post would have been "Problem with page redirect, please help". Moderators can sometimes apply a warning for using a subject topic like the one you have used. Just some friendly advice. |
|
|
|
Jan 9 2006, 09:11 AM
Post
#3
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 130 Joined: 21-December 05 Member No.: 15,990 |
I use Header php-function for redirection in me pages!
Code like CODE <meta http-equiv="refresh" content="5;url=http://www.mysite.com/nextpage.html"> About php function - Header The special case is the "Location:" header. Not only does it send this header back to the browser, but it also returns a REDIRECT (302) status code to the browser unless some 3xx status code has already been set. CODE <?php header("Location: http://www.example.com/"); /* Redirect browser */ /* Make sure that code below does not get executed when we redirect. */ exit; ?> Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself: CODE <?php header("Location: http://" . $_SERVER['HTTP_HOST'] . rtrim(dirname($_SERVER['PHP_SELF']), '/\\') . "/" . $relative_url); ?> Note: Session ID is not passed with Location header even if session.use_trans_sid is enabled. It must by passed manually using SID constant. View full description about Header function at http://php.rinet.ru/manual/ru/function.header.php with some examples. |
|
|
|
Jan 9 2006, 01:29 PM
Post
#4
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 630 Joined: 12-August 05 From: Melbourne, Australia Member No.: 10,624 |
@DeveloperX
Does the header() function provide him with the delay he wants? He said he already tried using the header() function but couldn't get it to put a delay in before it redirected. Is there a delay type function in PHP that can be combined with the header() function, something like the javascript timeout() function perhaps? I don't know enough about PHP to answer that question. |
|
|
|
Jan 10 2006, 10:38 AM
Post
#5
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 130 Joined: 21-December 05 Member No.: 15,990 |
@Avalon
Guys! Please seeee my next source code example! CODE <?php //For Ex. I want wait 2 seconds $sec0=2;//delay $sec1=date('s');//current server second $sec2=-1;//for first cycle begin while($sec2<$sec1+$sec0){$sec2=date('s');} header("Location: http://www.example.com/"); /* Redirect browser */ exit; ?> You may check this script! Very cool! It's my coolest idea... |
|
|
|
Jan 10 2006, 12:17 PM
Post
#6
|
|
|
Privileged Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 630 Joined: 12-August 05 From: Melbourne, Australia Member No.: 10,624 |
QUOTE(DeveloperX @ Jan 10 2006, 09:38 PM) Very nicely done, that should solve his wait problem. I have to agree with you, it's simple and very cool. |
|
|
|
Jan 13 2006, 02:50 PM
Post
#7
|
|
|
Advanced Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 130 Joined: 21-December 05 Member No.: 15,990 |
QUOTE Very nicely done, that should solve his wait problem. I have to agree with you, it's simple and very cool One moment please, You must check "MAX TIME EXECUTION" on your server php-configuration! Usefully it equal 30 seconds! But some hosting providers set this parameter for more 30 secs!!! |
|
|
|
Dec 14 2007, 07:15 PM
Post
#8
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,360 Joined: 21-September 07 Member No.: 50,369 |
I like the script since it works, but you need to be able to write to the document.
I'd like to be able to say "Thanks for registering. Please wait while the page redirects you" or something. -nate [note=Approved by BH][/note] |
|
|
|
Aug 25 2008, 08:37 AM
Post
#9
|
|
|
Trap Double Mocha Member ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 2,360 Joined: 21-September 07 Member No.: 50,369 |
Protected Sub LinkBack_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Using Page parameters for Back Navigation If Not Request.Params("ID") Is Nothing Then Response.Redirect("ExpertsGallery.Aspx") Else 'String url contains aspx page name from page parameter "URL" Dim url As String = Request.QueryString("URL") Response.Redirect(url.ToString()) End If End Sub In this code else block dosent work -reply by Ratnesh Kumar |