Hacker News new | ask | show | jobs
by roblabla 2295 days ago
What are legit uses for modifying a link on click? I've only seen that used for tracking.
1 comments

The classic use is after a site redesign or migration to a new domain, due to organizational name change, or whatever. You don't want to break all of the incoming links that are out there, but you want people to get to the page they were trying to reach.
That's handled by redirects with HTTP 301 messages, not JavaScript hijacking links on the referrer page, which is what Google search pages do.
I might have badly expressed myself - I'm specifically talking about changing the link target in the link's onclick handler like Google does, such that the link target shown in the browser is different from the actual target.