【发布时间】:2013-04-28 07:53:54
【问题描述】:
正如许多已经在其他问题中发布的(也在 jQuery 文档中),旧的 jQuery.browser.version 已被弃用,仅在 jquery1.3 中有效。
你知道另一种简单的检测方法吗,我可以在之前的代码中包含它:
function handleInfoDivPopupVisibility(dynamicEleId, staticEleId){
var parentContainer = $('headerSummaryContainer');
var dynamicEle = $(dynamicEleId);
var staticEle = $(staticEleId);
if(isIE() && parentContainer){
if (jQuery.browser.version != 10) { // I need to find a way to detect if it's IE10 here.
parentContainer.style.overflow = 'visible';
}
}
dynamicEle ? dynamicEle.style.display = '' : '';
if(dynamicEle && staticEle)
gui_positionBelow(dynamicEle, staticEle);
}
在你说这是this 或this 的重复问题之前,我想强调一下我不想使用css hacks。有没有办法像我以前一样简单地检测它?
if (jQuery.browser.version != 10) {...
【问题讨论】:
-
你可以使用 Modernizr。
-
您似乎只是在尝试修复影响 IE
-
问题是什么,也许我们可以帮助您解决问题而不是解决它,这样如果它也影响 IE11,但不是 12,您没有一堆 if 语句无处不在(而且您无需触摸代码即可对其进行更新)
-
@Jan Dvorak,回复您对已删除答案的评论 - msdn.microsoft.com/en-us/library/ie/hh801214(v=vs.85).aspx
-
但真正的问题是什么???我们还没有看到它。与其使用一些有缺陷且不可靠的用户代理嗅探技术,不如您可以相对轻松地解决真正的问题。
标签: javascript jquery cross-browser internet-explorer-10