I have this bit of code in my Chrome extension, so I can use <div href="url">
as a link.
This used to work as expected until recently. (Left - open in current tab, Middle - open in new tab). Now it only registers left clicks.
$('div.clickable-href').on('click', function(e) {
switch(e.which) {
case 1:
window.location = $(this).attr('href');
break;
case 2:
window.open($(this).attr('href'));
break;
case 3:
break;
}
});
I use <div href="url">
and <span href="url">
for links so the browser doesn't display the status bar.
I have found some similar questions, but all answers suggest using .on('mousedown', (e) => {...})
. I need this event to trigger only if there was a mousedown
event followed by a mouseup
event.
What's even more frustrating is that this used to work, but it no longer does so.
EDIT:
This is an issue for Chrome 55. On Linux (where I first noticed the anomaly) Chrome was already updated to v55. On my Windows system, it was v54, and middle click was working. Updating from 54 to 55 caused the same problems.