url forward with query string

Discussion in 'Javascript' started by Adrian, Dec 6, 2005.

  1. Adrian

    Adrian Guest

    Adrian, Dec 6, 2005
    #1
    1. Advertising

  2. Adrian

    Randy Webb Guest

    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/
    Randy Webb, Dec 6, 2005
    #2
    1. Advertising

  3. 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.
    Dennis Ålund, Dec 6, 2005
    #3
  4. Adrian

    web.dev Guest

    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";
    web.dev, Dec 6, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jon paugh
    Replies:
    1
    Views:
    687
  2. qazmlp
    Replies:
    1
    Views:
    586
    Jonathan Turkanis
    Feb 15, 2004
  3. Just D.
    Replies:
    0
    Views:
    406
    Just D.
    Aug 11, 2004
  4. ~greg
    Replies:
    5
    Views:
    128
    ~greg
    Apr 27, 2005
  5. nick
    Replies:
    1
    Views:
    442
    David Mark
    Feb 13, 2011
Loading...

Share This Page