C
chambers.anya
Hi,
I've just been scouring the web trying to find an answer for how to do
this but so far without any success.
Basically I want some of the links in my page to open in new tabs (I'm
using Firefox) or windows if the user has their options configured
that way. And I want my page to remain intact as it involves some AJAX
and takes a while to load.
But ...and this seems to be a big "but"... I don't want the focus to
move away from the page I'm on. So techniques such as <a
target="_blank"> or <a onclick="window.open(...)"> aren't working for
this requirement. I even tried using a separate function and
attempting to return to the original window straight after using the
following function:
// Open a URL in a new window or tab (depending on browser-specific
settings) and move focus to it
function openLinkInNewWindow(link) {
var newWindow = window.open(link);
window.opener.focus();
}
But in Firefox this is just causing both tabs to open the new link.
So now I'm scratching my head and wondering if it's going to be
possible at all. Is there something I've missed? Thanks a lot for any
help or advice (but please don't condone me for opening these links in
new windows or ask why I want to do it, trust me, I do!!!)
Cheers
Steve
I've just been scouring the web trying to find an answer for how to do
this but so far without any success.
Basically I want some of the links in my page to open in new tabs (I'm
using Firefox) or windows if the user has their options configured
that way. And I want my page to remain intact as it involves some AJAX
and takes a while to load.
But ...and this seems to be a big "but"... I don't want the focus to
move away from the page I'm on. So techniques such as <a
target="_blank"> or <a onclick="window.open(...)"> aren't working for
this requirement. I even tried using a separate function and
attempting to return to the original window straight after using the
following function:
// Open a URL in a new window or tab (depending on browser-specific
settings) and move focus to it
function openLinkInNewWindow(link) {
var newWindow = window.open(link);
window.opener.focus();
}
But in Firefox this is just causing both tabs to open the new link.
So now I'm scratching my head and wondering if it's going to be
possible at all. Is there something I've missed? Thanks a lot for any
help or advice (but please don't condone me for opening these links in
new windows or ask why I want to do it, trust me, I do!!!)
Cheers
Steve