469,331 Members | 1,912 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,331 developers. It's quick & easy.

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.com to get the url /data1

Is this possible? If so how

TIA

Coamp
Mar 27 '08 #1
4 1183
SAM
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 ?
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.replace(strg1,strg2);
alert(this.href);
">link</a>

--
sm
Mar 27 '08 #2
SAM wrote on 27 mrt 2008 in comp.lang.javascript:
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.etiSonroPreh'.split('').reverse().join('');
this.href = this.href.replace(strg1,strg2);
alert(this.href);
">link</a>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 27 '08 #3
SAM
Evertjan. a écrit :
>
var strg2 = 'moc.etiSonroPreh'.split('').reverse().join('');
Rhhoooô !

--
sm
Mar 27 '08 #4
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.com
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.
Mar 27 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Tony Gahlinger | last post: by
7 posts views Thread by jerrygarciuh | last post: by
33 posts views Thread by Joerg Schuster | last post: by
reply views Thread by John Smith | last post: by
14 posts views Thread by Brent Burkart | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by Purva khokhar | last post: by
1 post views Thread by haryvincent176 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.