在新的 Web 应用程序上,针对 IE7 并使用强制 IE8 进入 IE7 模式的标签会产生什么后果?

发布于 2024-10-07 16:48:09 字数 753 浏览 0 评论 0 原文

我真的不想这样做,我想瞄准最新的浏览器。针对旧版浏览器然后强制 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()).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

雪化雨蝶 2024-10-14 16:48:09
  • 看看你的代码。
  • 看看你哪里做错了。
  • 修复你的代码。
  • 观察它在 IE8 中的工作情况

理想情况下,您想要做的就是使您的整个网站与 IE8 兼容。 IE7 本身在很大程度上与 FF 和 FF 不兼容。 Chrome 标准并且需要大量的黑客工作。

将合规性从 IE8 升级到 IE9 将会变得更加容易,因为 IE9 不能很好地处理 IE6/7 代码。

jQuery 将在 IE8 中正常工作。我无法理解 CSS 在 IE7 和 IE7 中的工作原理。 FF(我们说的是 FF3.6 对吗?不是 FF 1.5?),但在 IE8 中不起作用。这是一个明显的迹象,表明您的设置有问题。

  • Look at your code.
  • Look at where your doing it wrong.
  • Fix your code.
  • Watch it work in 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.

新一帅帅 2024-10-14 16:48:09

令人惊讶的是 jQuery 在 IE8 中没有“正常运行”。 7 和 8 之间的 CSS 肯定存在差异,但是您在 jQuery 中到底做了什么在 8 中不起作用的事情呢?

另外,使用 IE 条件语句不是一个选择吗?即

<!--[if IE 8]>
Special instructions for IE 8 here
<![endif]-->

更新:

有时使用 $ 符号可能会导致问题,具体取决于您正在进行的其他操作。使用“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.

<!--[if IE 8]>
Special instructions for IE 8 here
<![endif]-->

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....

江湖彼岸 2024-10-14 16:48:09

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).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文