capturing and changing the link

B

browser newbie

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
 
S

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>
 
E

Evertjan.

SAM wrote on 27 mrt 2008 in comp.lang.javascript:
browser newbie a écrit :

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.

<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('');
 
T

Thomas 'PointedEars' Lahn

Jeremy said:
[...]
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.

It is a *very* *bad* idea.
*) If the user does not have Javascript enabled,

.... or supported ...
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.

ACK to those to, but ...
*) It can break search engines.

.... please elaborate on this.


PointedEars
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top