我真的不想这样做,我想瞄准最新的浏览器。针对旧版浏览器然后强制 IE8 以兼容模式运行似乎有点倒退。我想知道IE9出来后会发生什么?
然而,JQuery 和 CSS 在 IE8 中正常运行时都存在一些问题,它在 IE7 和 Firefox 中运行良好,我相信甚至在 Chrome 中也能正常运行。我希望这个东西至少能在 IE7、IE8、FF 中运行良好。有更好的方法还是我应该在 IE8 上使用这个标签?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
这样做可能存在哪些风险? 我只是感觉不对劲,但我确实没有任何确凿的证据来支持我的恐惧。我的直觉是,这会在未来带来问题,并可能导致大量返工。想法?
更新:这是实际问题本身...
if (dir == "back" || dir == "jump") {
$.get(prevNode.attr("href") + "&bID=" + bID + "&ieRefresh=" + Math.random(), "",
function(data) {
p.nav.prevHtml = data;
});
}
错误是:
对象不支持此属性或方法第 390 行,字符 37(这些“坐标”找到的字符是美元$.get() 的符号)。
I really don't want to do it, I want to target the latest browser. It seems a little backwards to target a legacy browser and then force IE8 to run in a compatibility mode. I wonder what would happen when IE9 came out?
However JQuery and CSS are both having some issues running properly in IE8, it works fine in IE7 and Firefox and I believe even Chrome. I want this thing to run well in IE7, IE8, and FF at least. Is there a better way or should I just use this tag for IE8?
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
What could be the risks for doing this? I just don't feel right about it but I don't really have any founded evidence to support my fears. My gut feeling is that it will cause problems down the road and create a potential for much rework. Thoughts?
UPDATE: Here is the actual problem itself...
if (dir == "back" || dir == "jump") {
$.get(prevNode.attr("href") + "&bID=" + bID + "&ieRefresh=" + Math.random(), "",
function(data) {
p.nav.prevHtml = data;
});
}
The error is:
Object doesn't support this property or method line 390, character 37 (the character that is found by these 'coordinates' is the dollar sign of the $.get()).
发布评论
评论(3)
理想情况下,您想要做的就是使您的整个网站与 IE8 兼容。 IE7 本身在很大程度上与 FF 和 FF 不兼容。 Chrome 标准并且需要大量的黑客工作。
将合规性从 IE8 升级到 IE9 将会变得更加容易,因为 IE9 不能很好地处理 IE6/7 代码。
jQuery 将在 IE8 中正常工作。我无法理解 CSS 在 IE7 和 IE7 中的工作原理。 FF(我们说的是 FF3.6 对吗?不是 FF 1.5?),但在 IE8 中不起作用。这是一个明显的迹象,表明您的设置有问题。
Ideally what you want to do is make your entire website compatible with IE8. IE7 by itself is largely incompatible with FF & Chrome standards and requires a lot of hacking.
It's going to be significantly easier for you to upgrade compliance from IE8 to IE9 because IE9 isn't going to deal with IE6/7 code nicely.
jQuery will work properly in IE8. I can't fanthom what CSS works in IE7 & FF (Were talking FF3.6 right? not FF 1.5?) but doesn't work in IE8. This is a clear sign that your set up is doing something wrong.
令人惊讶的是 jQuery 在 IE8 中没有“正常运行”。 7 和 8 之间的 CSS 肯定存在差异,但是您在 jQuery 中到底做了什么在 8 中不起作用的事情呢?
另外,使用 IE 条件语句不是一个选择吗?即
更新:
有时使用 $ 符号可能会导致问题,具体取决于您正在进行的其他操作。使用“jQuery”而不是“$”有什么作用吗?我在 IE8 中尝试了你的代码,没有收到任何错误......
It's surprising that jQuery isn't "running properly" in IE8. There are definitely differences in CSS between 7 and 8, but what exactly are you doing in jQuery that isn't working in 8?
Also, is using IE conditional statements not an option? i.e.
UPDATE:
Sometimes using the $ sign can cause problems depending on whatever else you have going on. Does using "jQuery" instead of "$" do anything? I tried out your code in IE8 and didn't get any errors....
IE8 和 IE9 都包含 IE7 渲染引擎(或非常接近的引擎),最好强制 IE 进入您知道有效的模式,而不是留下任何损坏。
话虽如此,为了获得最佳的向前兼容性,您应该调查并更正您的网站,以便在 IE8 或至少 IE9 中正常工作。 IE8 并不完美,但如果您不进行任何浏览器检测,jQuery 和 CSS 2.1 都应该表现得非常好。 IE 团队有一篇关于使用 功能检测而不是浏览器嗅探(这可能是这里的问题)。
IE8 and IE9 both include the IE7 rendering engine (or something very close), it's better to force IE into a mode that you know works than leave anything broken.
Having said that, for best forwards compatibility you should investigate and correct your site to work properly in IE8 or at a minimum IE9. IE8 is not perfect but if you're not doing any browser detection jQuery and CSS 2.1 should both behave extremely well. The IE team has a nice blog post about using feature detection rather than browser sniffing (which is likely the problem here).