replace address bar url to another

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    replace address bar url to another

    Hi

    i'm trying 2 open a popup windows, but problem whn it's opening it's url address is like this

    - > http://www.mysite.com/order.asp?value=32

    there is no problem with this what i would like to do is
    replace only the address bar into this

    - > http://www.mysite.com/

    and result gonna be the 1st url with the value only showing it ?
    any body know how 2 do the job ? thxs in advance.
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Window.location and RegExp can help you.

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #3
      If you set window.location , it will redirect to a new page. You could use a frame/iframe on the page and set it to the desired location.

      Comment

      • Fary4u
        Contributor
        • Jul 2007
        • 273

        #4
        Hi thxs 4u reply, could u explain it how coz i've tryed it but still struggling to do this kind of job.

        i don't care it's popup or new windows but main query is

        i wanna replace 1st link to 2nd link
        but keep executed the 1st link.

        1st link - > http://www.mysite.com/order.asp?value=32

        2nd link - >http://www.mysite.com/

        Comment

        • Fary4u
          Contributor
          • Jul 2007
          • 273

          #5
          hi any body knws how 2 do this ?
          thanks in advance

          Comment

          • hsriat
            Recognized Expert Top Contributor
            • Jan 2008
            • 1653

            #6
            Well, I can't understand what you trying to achieve, but you might find this useful:
            Code:
            var locationPattern = /^http\:\/\/[a-zA-Z0-9\.]+\//;
            var base = locationPattern.exec(location.href);
            Now use the base variable where ever you want.

            Comment

            • iam_clint
              Recognized Expert Top Contributor
              • Jul 2006
              • 1207

              #7
              The functionality this user is trying to accomplish is not possible.

              How I interpreted
              Example:
              You are viewing www.somesite.com/blah.php?a=1
              But make the address bar show:



              You can do this with some serverside coding to call those scripts and do a redirect back to main page passing some information in session about what page they were wanting to view and pull those files.. but javascript based would violate some security.. example of doing this has been done before but its malicious using a popup window to display directly over the address bar to make you think you are on x page

              Comment

              • Amzul
                New Member
                • Oct 2007
                • 130

                #8
                ummm .htaccess file can come handy here, trim all the url and live just the host name.
                if you like to get only the host name in javascript try
                var url = location.hostna me

                Comment

                • acoder
                  Recognized Expert MVP
                  • Nov 2006
                  • 16032

                  #9
                  If you want a JavaScript solution, open the pop-up window with the home page (with a full window frame) and then set the location from the parent (opening) window.

                  Comment

                  Working...