I don't know exactly the cause of this symptom but here goes. In our web app, we call window.open
to open a new window/tab (internally everyone's is set to open in a new tab). After opening this new tab, IE8 immediately switches the focus to it.
We then integrated a web service, so we call this web service which in turn invokes a callback javascript function when it returns. We are now calling window.open
from inside the callback function. When we do this, I开发者_Go百科E8 opens the new tab but does not switch the focus. Calls to window.focus
on the parent page and the child page do nothing.
Now, I know javascript is not threaded, but is this something to do with asynchronicity? Is there a way to get the browser to behave as expected?
I believe that by default, IE will only switch focus to the new tab if it was opened as a result of a user-initiated action such as a click. If the window.open
call is not in response to a UI action then IE is probably opening the tab in the background as if it were some kind of popup, though obviously it's not being blocked by the popup blocker.
If you are in an intranet environment and can specify settings, have you tried setting the "Always switch to new tabs when they are created" check box on the tabbed browsing settings dialog?
精彩评论