Answer the question
In order to leave comments, you need to log in
href substitution when handling the onclick event. Is this a browser security issue?
Today I needed to make sure that after clicking on a link, its address changes to another one, so that when you click again, you can already go to it. And all of a sudden it didn't work the way I imagined it would, and could be a great opportunity for spammers, scammers, and other bad people.
Initially, the link itself looked like this <a href="#mail">E-mail</a>
. A click on the link was processed with something like this code:
function email_clicked()
{
this.href = "mailto:[email protected]";
return true;
}
Answer the question
In order to leave comments, you need to log in
That's what the onclick event is for, so that at the moment of clicking, handle this click as necessary. This is not a vulnerability, but a regular js code.
You can make a bunch of such links, but sooner or later such a site will be completely without visitors, and a couple of user complaints about a suspicious website (through a browser) will reduce its attendance to absolute zero.
So: yes - it's possible, yes - this is not a vulnerability or a bug, BUT - it's better not to do this and not mislead users.
This is usually done by those who want to make money on ads for clicks
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question