Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > url forward with query string

Reply
Thread Tools

url forward with query string

 
 
Adrian
Guest
Posts: n/a
 
      12-06-2005
Hi
is it possible (if so how) to do a redirect / url forward with query
string

i.e.
www.test1.com?pram1=a?pram2=b

is forwarded to
www.test2.com?pram1=a?pram2=b

Thanks


 
Reply With Quote
 
 
 
 
Randy Webb
Guest
Posts: n/a
 
      12-06-2005
Adrian said the following on 12/6/2005 7:15 AM:
> Hi
> is it possible (if so how) to do a redirect / url forward with query
> string


Yes it is possible.
How? Add the query string to the URL before redirecting.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
 
Reply With Quote
 
 
 
 
Dennis Ålund
Guest
Posts: n/a
 
      12-06-2005
Use either
header("Location: http://www.test2.com"._SERVER["REQUEST_URI"]);
before anything is written to the document(!) as soon as the first
headers are sent to the browser this won't work.

Or you can have a redirect meta tag in <head> looking like this:
<meta http-equiv='Refresh'
content='0;http://www.test2.com<?=_SERVER["REQUEST_URI"]?>'>
The digit 0 (zero) before the semicolon in 'content' tell the browser
to redirect with 0 seconds delay... which you can change if you want to
display "You are now redirected to test2"

The choice depends a little on when redirection is supposed to happen.

 
Reply With Quote
 
web.dev
Guest
Posts: n/a
 
      12-06-2005

Adrian wrote:
> Hi
> is it possible (if so how) to do a redirect / url forward with query
> string
>
> i.e.
> www.test1.com?pram1=a?pram2=b
>
> is forwarded to
> www.test2.com?pram1=a?pram2=b
>
> Thanks


In addition to the solutions above, you can also do the following in
javascript:

location.href = "www.test2.com?pram1=a&pram2=b";

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to convert url with query string to url without query string nick Javascript 1 02-13-2011 11:20 PM
conflict between query-part of url and visited-state of url ~greg Javascript 5 04-27-2005 05:58 PM
URL - substitution of a correct URL by a GUID like URL in favorites. Just D. ASP .Net Mobile 0 08-11-2004 04:26 PM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
Re-forward declaration of types which were already forward declared qazmlp C++ 1 02-15-2004 07:00 PM



Advertisments