After you open
the new window (we'll call it newWindow
), do this:
newWindow.blur();
window.focus();
This is usually called a "pop-under." Opening the window won't usually work unless it's initiated by a user action like a mouse click, due to pop-up blockers built into most web browsers.
Just remember to get a handle to your new window when you open it.
var newWindow = window.open(...);
Also, if your pop-under is loading content from another domain, you'll need to do the blur
/focus
thing before you send the window to its destination, otherwise you'll run into the same-origin problem.
HTML:
JS:
function popUnder(node) {
var newWindow = window.open("about:blank", node.target, "width=500,height=500");
newWindow.blur();
window.focus();
newWindow.location.href = node.href;
return false;
}