views:

822

answers:

2

In Firefox 3, when I open a new window (or tab), using window.open, the new window has focus, which is what I want.

In IE, the old window still has focus for some reason, so I have researched the problem my window.open code does this now.

  var w = window.open("Sheet.aspx", "_blank");
  w.focus();

Unfortunately, this isn't working for me in IE 7. The old window still has focus. What I am missing here?

I have IE set to open new pages in a tab, rather than a new page, and I've allowed popups for the domain my site is on.

I can see the IE progress indicator going on the second tab, but it never switches over to it.

+1  A: 

I have almost exactly the same code in one of my web apps which works just fine in IE7. Does it work if you disable the pop-up blocker? Do you have any extensions/toolbars installed which do pop-up blocking, and can you try disabling them?

--edit:

My code is different to yours as it supplies a width and a height for the window so it opens as a pop-up, but if I set IE to 'Always open pop-ups in a new tab' it still focusses on the window for me but I have pop-up blocker completely turned off. I still think the most likely source of your problem is either the pop-up blocker or an add-on.

robertc
I found my solution. I needed to check "Always switch to new tabs when they are created" in IE 7's tab options
Tony Peterson
Note that I don't have that option ticked and it still worked for me with the win.focus() call, as long as you're happy though :)
robertc
A: 

hi friends, i am also having the same problem. if my parent window has contain a multiple tab it doesn't focus on parent window.

please give me solution.

golden