Reputation: 8161
i want to open a new tab on click but i want to previous tab always active, child tab not active by default
My code is-
<a onclick="window.open(URL); self.focus();>Click</a>
Upvotes: 1
Views: 8343
Reputation: 4399
You can write code onload of the new window that gives focus back to the opener:
window.opener.focus();
notice that window.open opens a new window not a new tab, target=_blank
opens a new tab (optionally according to browser settings)
Upvotes: 0
Reputation: 2268
This behaviour is up to the browser and can't be controlled by Javascript.
Upvotes: 4