capturing and changing the link

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • browser newbie

    capturing and changing the link



    Hello

    How can I capture the link a user clicks on ? After capturing will I
    be able to form the HTTP request so that I can change the server its
    going to?

    For example...if the URI in the page says www.link1.com/data1, should
    the user click on it, I would like this to be send to
    server1.link1.c om to get the url /data1

    Is this possible? If so how

    TIA

    Coamp
  • SAM

    #2
    Re: capturing and changing the link

    browser newbie a écrit :
    >
    Hello
    >
    How can I capture the link a user clicks on ? After capturing will I
    be able to form the HTTP request so that I can change the server its
    going to?
    >
    For example...if the URI in the page says www.link1.com/data1, should
    the user click on it, I would like this to be send to
    server1.link1.c om to get the url /data1
    I do not understand, can't you write dierctly the good code in your links ?
    Is this possible? If so how
    <a href="http://www.server_one. com/folder/datas.htm"
    onclick="var strg1 = 'server_one.com ';
    var strg2 = 'server_two.org ';
    this.href = this.href.repla ce(strg1,strg2) ;
    alert(this.href );
    ">link</a>



    --
    sm

    Comment

    • Evertjan.

      #3
      Re: capturing and changing the link

      SAM wrote on 27 mrt 2008 in comp.lang.javas cript:
      browser newbie a écrit :
      >>
      >Hello
      >>
      >How can I capture the link a user clicks on ? After capturing will I
      >be able to form the HTTP request so that I can change the server its
      >going to?
      >>
      >For example...if the URI in the page says www.link1.com/data1, should
      >the user click on it, I would like this to be send to
      >server1.link1. com to get the url /data1
      >
      I do not understand, can't you write dierctly the good code in your
      links ?

      Because the user would not dream to click the link, knowing the real URL.

      >Is this possible? If so how
      >
      <a href="http://www.server_one. com/folder/datas.htm"
      onclick="var strg1 = 'server_one.com ';
      var strg2 = 'server_two.org ';
      <a href="http://www.cnn.com/"
      ......
      var strg1 = 'cnn.com';
      var strg2 = 'moc.etiSonroPr eh'.split('').r everse().join(' ');
      this.href = this.href.repla ce(strg1,strg2) ;
      alert(this.href );
      ">link</a>
      >
      >
      >


      --
      Evertjan.
      The Netherlands.
      (Please change the x'es to dots in my emailaddress)

      Comment

      • SAM

        #4
        Re: capturing and changing the link

        Evertjan. a écrit :
        >
        var strg2 = 'moc.etiSonroPr eh'.split('').r everse().join(' ');
        Rhhoooô !

        --
        sm

        Comment

        • Jeremy J Starcher

          #5
          Re: capturing and changing the link

          On Wed, 26 Mar 2008 16:58:07 -0700, browser newbie wrote:
          Hello
          >
          How can I capture the link a user clicks on ? After capturing will I be
          able to form the HTTP request so that I can change the server its going
          to?
          >
          For example...if the URI in the page says www.link1.com/data1, should
          the user click on it, I would like this to be send to server1.link1.c om
          to get the url /data1
          >
          Is this possible? If so how
          Yes, this is possible as described in a couple of ways in this thread,
          but it *is* a bad idea.

          *) If the user does not have Javascript enabled, they will not go where
          you want them to go.

          *) If this is used to "trick" someone to follow a link they do would not
          normally follow, you risk offended and making your visitors mad. If
          you did this to me, I would not return to your page.

          *) It can break search engines.

          Comment

          Working...