Hacker News new | ask | show | jobs
by wldlyinaccurate 4644 days ago
> The alternative is to hijack the click event, wait for say 100ms, and then load the new page via JavaScript, but that also break the open in a new tab functionality.

How does it break the open in new tab functionality? You can detect if the user was Cmd/Ctrl-clicking, or using the middle mouse button. I've done this on many sites and it works fine.

2 comments

That's a good point. I suppose I could try to detect if the click was accompanied by a CTRL/CMD keypress and open in a new tab accordingly.

Still, the 100ms delay isn't ideal, and the open in a new tab paradigm greatly simplifies things.

Your analytics aren't as important as my user experience. :)
Perhaps if you were my customer, but you're just consuming the free content I've spent a good deal of time putting together :)
That doesn't include the possibility that the user right-clicks and selects "Open Link in New Tab"