I am trying to fire a mouse event that would mimic Browser's Ctrl+ mouseclick when clicking on a hyperlink to open a new tab but keep current tab selected. Here is my code:
var link = document.createElement('a');
link.href = 'URL';
document.body.appendChild(link);
link.dispatchEvent(new MouseEvent('click', {ctrlKey: true}))
It does open a new tab but also switches to it. Any chance to keep it on the currect tab?
Thanks