how to convert url with query string to url without query string

Discussion in 'Javascript' started by nick, Feb 13, 2011.

  1. nick

    nick Guest

    Hi All,

    I would appreciate any help in converting an url with query string
    (http://mywebsite/cgi-bin/web_case_mgt.exe?
    CASE_KEY=00000000630520110213&STYPE=DISPLAY) to one that does not
    contain any parameters (http://mywebsite/cgi-bin/web_case_mgt.exe). My
    application is a cgi application with the server side generating
    dynamic html pages (using C++). On the server side I am replacing the
    current web page (web_new_case.exe) with a new one by generating the
    following JavaScript code:
    <form>
    <Script language="JavaScript" type="text/javascript">
    location.replace("web_case_mgt.exe?CASE_ID=12343&STYPE=DISPLAY");
    </script>
    </form>

    NOTE: web_new_case.exe and web_case_mgt.exe are programs running in
    the background and listening to a socket.

    Question: What Javascript code should I use to achieve the desired
    effect?
     
    nick, Feb 13, 2011
    #1
    1. Advertising

  2. nick

    David Mark Guest

    On Feb 13, 6:10 pm, nick <> wrote:
    > Hi All,
    >
    > I would appreciate any help in converting an url with query string
    > (http://mywebsite/cgi-bin/web_case_mgt.exe?
    > CASE_KEY=00000000630520110213&STYPE=DISPLAY) to one that does not
    > contain any parameters (http://mywebsite/cgi-bin/web_case_mgt.exe). My
    > application is a cgi application with the server side generating
    > dynamic html pages (using C++). On the server side I am replacing the
    > current web page (web_new_case.exe) with a new one by generating the
    > following JavaScript code:


    Markup.

    > <form>


    Why a form?

    > <Script language="JavaScript" type="text/javascript">


    Start tag doesn't match the end and the language attribute is
    deprecated.

    > location.replace("web_case_mgt.exe?CASE_ID=12343&STYPE=DISPLAY");
    > </script>
    > </form>


    And why wouldn't you redirect with a location header? Your approach
    will fail if scripting is disabled (among other ways).

    >
    > NOTE: web_new_case.exe and web_case_mgt.exe are programs running in
    > the background and listening to a socket.


    Noted. :)

    >
    > Question: What Javascript code should I use to achieve the desired
    > effect?


    https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace

    But I think you should be doing this server side.
     
    David Mark, Feb 13, 2011
    #2
    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. Joe
    Replies:
    7
    Views:
    2,470
    Matt Berther
    Feb 8, 2005
  2. Replies:
    7
    Views:
    4,392
    R. Rajesh Jeba Anbiah
    Feb 6, 2005
  3. Russell Warren
    Replies:
    4
    Views:
    500
    Stefan Behnel
    Jul 13, 2006
  4. Joe
    Replies:
    6
    Views:
    183
    teknohippy
    Feb 7, 2005
  5. Replies:
    2
    Views:
    185
    John Bokma
    Aug 30, 2013
Loading...

Share This Page