11
First of all, I am not having a real problem. I'm asking this out of curiosity only.
I accidentally run into a strange behaviour when using javascript:void(0) and target="_blank" within the same link, like this.
<a href="javascript:void(0);" target="_blank" /> Link </a>
I found that Chrome is handling this normally and not doing anything when you click the link, while IE and Firefox open up a blank new tab.
My question is, isn't javascript:void(0) supposed to prevent any click event firing from a link, even if it targets new tab/window? And why is target="_blank" overiding it?
Also what is the best approach if I am, let's say, filling the href attribute with some backend language and I prefer target="_blank" hard coded beside the href attribute?