Jump to content
xisto Community
Sign in to follow this  
ashish_m_k

Problem With Page Redirect Help me out with this problem...

Recommended Posts

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!

Notice from jlhaslip:
Thanks Avalon, topic changed.
Edited by jlhaslip (see edit history)

Share this post


Link to post
Share on other sites

The simplest way to do this is to use a <META> tag in between the <HEAD> tags of your document. Here's an example...

<meta http-equiv="refresh" content="5;url=http://forums.xisto.com/no_longer_exists/;
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. :)

Share this post


Link to post
Share on other sites

I use Header php-function for redirection in me pages!

Code like



<meta http-equiv="refresh" content="5;url=http://mysite.com/nextpage.html;

can be stopped by Escape button pressing!!!

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.
 



<?phpheader("Location: 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:
 



<?phpheader("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.



Share this post


Link to post
Share on other sites

@DeveloperXDoes 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.

Share this post


Link to post
Share on other sites

@Avalon

Guys! Please seeee my next source code example!



<?php//For Ex. I want wait 2 seconds$sec0=2;//delay$sec1=date('s');//current server second$sec2=-1;//for first cycle beginwhile($sec2<$sec1+$sec0){$sec2=date('s');}header("Location: example.com"); /* Redirect browser */exit;?>  

You may check this script! Very cool! It's my coolest idea...


Share this post


Link to post
Share on other sites

You may check this script! Very cool! It's my coolest idea...

219897[/snapback]

Very nicely done, that should solve his wait problem. I have to agree with you, it's simple and very cool. :)

Share this post


Link to post
Share on other sites

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!!!

Share this post


Link to post
Share on other sites

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]

Share this post


Link to post
Share on other sites

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 SubIn this code else block dosent work-reply by Ratnesh Kumar

Share this post


Link to post
Share on other sites
HTML redirectProblem With Page Redirect

I hope I can explain this. I have a site with an inline frame. In the inline frame I have it calling a page to logon. I want it to redirect the users to a new page in the members directory. The problem I have is the redirect loads into the same frame. I need a page refresh to the new page. I don't want it to open another page, just reload the new page on the browser page thats already open.

-question by Steve

Share this post


Link to post
Share on other sites
Me too Help Me!Problem With Page RedirectWhen I click on a link when I search google, it always redirects me to another website aboutInsurance and other crap!Please help me it never happended before!@#%!-reply by Jay Oh

Share this post


Link to post
Share on other sites

When I click on a link when I search google, it always redirects me to another website about Insurance and other crap!

Sounds to me like a malware issue. Get some good Anti-Malware software, and use it. If it comes up with errors when you run it, shut down the computer and turn it back on, this time booting it in safe mode (then run it). Should be fixed then.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.