The following code works well when I open or want to set focus to a
subWindow. I would like to set focus to a specific tab in the same manner.
For example a link in tab1 either opens a new tab is it does not exists or
if it is already created set focus to that tab. How can this code be
reworked to do that?
Thank you in advance
Claus
var dWindow;
function doDetail(cUrl)
{
if (!dWindow || dWindow.closed) {
dWindow = window.open(cUrl,"subwin");
} else {
// window is already open, so bring it to the front
dWindow.focus();
}
}
> If this is the wrong news group to post this question, please direct me the
> proper news group so I can repost.
As I don't think this is related to HTML I'm cross-posting it to
mozilla.dev.web-development (followup-to set).
> The following code works well when I open or want to set focus to a
> subWindow. I would like to set focus to a specific tab in the same manner.
> For example a link in tab1 either opens a new tab is it does not exists or
> if it is already created set focus to that tab. How can this code be
> reworked to do that?
>
> Thank you in advance
> Claus
>
> var dWindow;
> function doDetail(cUrl)
> {
> if (!dWindow || dWindow.closed) {
> dWindow = window.open(cUrl,"subwin");
> } else {
> // window is already open, so bring it to the front
> dWindow.focus();
> }
> }
I guess the window.focus() function just activates the top-level
window the document frame is in. There may are practical reasons
for this behavior (in the case the window is opened in a tab) but I
can't point any at the moment.
--
Stanimir