IE9窗口失去焦点,由于jQuery Mobile的 [英] IE9 Window Loses Focus due to jQuery Mobile

查看:467
本文介绍了IE9窗口失去焦点,由于jQuery Mobile的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的产品,我们在我们的网站ASP.NET使用jQuery移动的最新开发版本。每个我们做一个ASP.NET回发时,浏览器窗口进行到屏幕的背面。

In our product, we're using the most recent development version of jQuery Mobile in our ASP.NET website. Each and every time we do an ASP.NET postback, the browser window goes to the back of the screen.

例如:


  • 最大化任何窗口。例如:可视化
    工作室的Word,Windows资源管理器。

  • 最大化IE9过去。 IE9是唯一
    一点你在屏幕上看到。

  • 单击在我们的解决方案的一个按钮,做
    回发。

  • IE9不再可见。
    无论是它背后现在有焦点
    (和充满屏幕,因为它是
    最大化)

只有解决方法,我知道:

Only workarounds I know:


  • 请不要包括jQuery Mobile的脚本。

  • 确保IE9是Windows唯一最大化的窗口。

我不知道是什么jQuery Mobile的是在后台做什么,我假定这是IE9中的错误,最终将被修复。不过,如果你对如何美元,在此期间发生的p $ pvent任何提示,这将是巨大的。

I don't know what jQuery Mobile is doing in the background and am assuming this is a bug in IE9 that will eventually be fixed. However, if you had any tips on how to prevent it from happening in the meantime, that would be great.

编辑:看来,这是不是在每次回发。这是每一个执行Response.Redirect的回发。我要补充一点,我所有的回传被实际利用ASP​​.NET AJAX,未满回发。

Seems it isn't on every postback. It is on every postback that performs a Response.Redirect. I should add that all my postback are actually utilizing ASP.NET AJAX, not full postbacks.

推荐答案

我知道这是一个古老的职位,但人们来到这里,从谷歌:

I know this is an old post, but for people coming here from Google:

今天我遇到了同样的问题。看来这失去焦点行为是当您触发窗口对象的模糊事件IE做了什么。这是code导致这个问题对我来说:

I ran into this same issue today. It seems this lose focus behavior is what IE does when you trigger the blur event on the window object. This was the code that caused this issue for me:

$(document.activeElement).blur();

activeElement将默认为体元件时,有在焦点没有其他元件,然后将模糊事件冒泡到窗口。为了解决这个问题,我只是不喜欢一个检查:

activeElement will default to the body element when there are no other elements in focus, and the blur event then bubbles up to the window. To fix this I simply did a check like:

if (document.activeElement != $('body')[0]) {
    $(document.activeElement).blur();
}

这篇关于IE9窗口失去焦点,由于jQuery Mobile的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆