在 IE6 中设计的 ASP.net Web 应用程序在 IE8 中存在兼容性问题

发布于 2024-11-02 16:46:38 字数 247 浏览 0 评论 0原文

我当前使用的网络应用程序设计为可在 IE6 中运行。但现在我的客户想要将应用程序升级到 IE8。我在系统中安装了IE8,但现在网页的对齐方式不如IE6。

文本框和其他一些字段从原来的位置移动,它们的长度和宽度也发生了变化。有些人建议将标签 放在 HTML 页面的 head 部分以实现兼容模式,但它对我不起作用。有人可以帮我吗..?

The web applications which I am currently using are designed to be work in IE6. But now my customer want's to upgrade the application to IE8. I installed IE8 in my system, but now the web pages are not well alligned as that in IE6.

The textboxes and some of the other fields moved from thier original positions, also thier lengths and breadths are changed. Some of the people suggested to put the tag <meta http-equiv="X-UA-Compatible" content="IE=IE5" > to the head section of the HTML pages for the compatible mode, but it didn't work for me. Could somebody please help me..?

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

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

发布评论

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

评论(4

内心荒芜 2024-11-09 16:46:38

这篇文章的标题总结了 IE6 的很多缺点,以及为什么它给当今的 Web 开发人员带来如此多的麻烦,以及为什么这么多公司长期以来不愿意进行升级。然而,即使是这些公司现在也被迫升级,因为根本无法获得 IE6 的新许可证。

UA-Compatible hack 并没有起作用,因为它所做的只是告诉 IE8 使用它的“旧版”渲染引擎来模拟旧版本的 IE。这听起来应该可行,但不幸的是,它只会降低 IE7 的兼容性。

所以您可以尝试IE7兼容模式。这并不能保证一定能成功,但我想它离 IE6 更近了一步。您应该能够通过更改已有的元标记来测试这一点,但您也可以通过转到开发人员工具来切换 IE8 中的渲染模式,该工具在窗口顶部有一个渲染模式切换开关。

所有这一切的问题在于它不会成为你的永久解决方案。即使您确实让它在 IE7 兼容模式下工作,也不能保证当用户升级到 IE9(他们很快就会开始这样做)时,IE7 模式将继续为您工作。 IE10 也在开发中。

如果您在网站上遇到的主要问题只是文本框和其他对象稍微移动,那么您实际上做得还不错 - 一些为 IE6 编写的网站在现代浏览器中损坏得太严重,甚至无法考虑升级它们;它们只需要被重写。但你的听起来应该是可以挽救的。

您的问题最有可能的罪魁祸首是怪癖模式。

Quirks 模式是旧版 IE(IE6 及更早版本)使用的一种呈现模式,而不是遵循定义的 Web 标准。 IE6 是第一个支持标准模式的 IE 版本,尽管为了与 IE5 兼容而默认使用怪异模式。在此之前,IE5仅使用quirks模式。这可能解释了为什么您收到的建议是尝试使用 IE5 兼容模式...但遗憾的是,该建议永远不会起作用。

Quirks 模式和 Standards 模式之间存在许多差异,但主要的差异是盒模型。简而言之,在怪异模式下,元素的大小(即它的高度和宽度)包括边框和边距,而在标准模式下则不包括。

这两种模式之间还存在一系列其他差异,但这才是真正导致最严重的页面布局损坏的差异。

听起来您的网站在设计时考虑了怪癖模式,而不是标准模式。不幸的是,您无法做太多事情来自动修复它;你只需要检查所有的样式,调整位置和大小,直到它起作用。

您还应该确保 HTML 代码顶部有有效的 Doctype 声明。这将帮助浏览器选择正确的渲染模式。没有它,您可能会发现有时仍然会陷入怪癖模式。

强烈建议您在其他浏览器(例如 Chrome 和 Firefox)中测试该网站。这可能会帮助您发现代码中 IE8 可能没有问题的其他错误。即使最终用户只打算使用 IE8,我也建议这样做,因为正如我所说,他们几乎肯定会在不久的将来升级到 IE9,不久之后就会升级到 IE10。 IE9 比 IE8 更符合标准,IE10 也会如此,这意味着如果页面在 Chrome 和 Firefox 中呈现良好,那么您应该有信心在启动时在 IE9 和 IE10 中也能正常显示。这将使您避免在一年内重复出现 IE6->IE8 问题。

希望有帮助。

如果您有任何特定的代码需要更多帮助,我建议将其发布在新问题下。

The title of this post sums up much that is bad about IE6 and why it's causing so many headaches for web developers today, and also why so many companies have been so reluctant for so long to make the upgrade. However, even those companies are being forced to upgrade now, as new licences for IE6 simply aren't available.

The UA-Compatible hack didn't work because all it does is tell IE8 to use it's 'legacy' rendering engine to emulate an older version of IE. This sounds like it should work but unfortunately for you, it only goes down as far as IE7 compatibility.

So you could try IE7-compatibility mode. That's not guaranteed to do the trick, but I guess it's one step closer to IE6. You should be able to test that by changing the meta tag you already have, but you can also switch the rendering mode in IE8 by going to the Developer Tools, which has a rendering mode toggle at the top of the window.

The trouble with all this is that it's not going to be a permenant fix for you. Even if you do get it working in IE7 compatibility mode, there's no guarantee that when users upgrade to IE9 (which they will start doing soon) that IE7 mode will continue to work for you. And IE10 is in development as well.

If the major problems you're having with the site are simply text boxes and other objects moving slightly, then you actually aren't doing too badly -- some sites written for IE6 are simply too badly broken in modern browsers to even consider upgrading them; they just have to be rewritten. But yours sounds like it ought to be salvageable.

The most likely culprit of your problem is Quirks Mode.

Quirks mode is a rendering mode that older versions of IE (IE6 and earlier) use instead of following the defined web standards. IE6 was the first version of IE that supported Standards Mode, although it defaulted to quirks mode for compatibility with IE5. Prior to that, IE5 only used quirks mode. This probably explains why the advice you had was to try using IE5 compatiblity mode... a pity that advice would never work, though.

There are a number of differences between Quirks mode and Standards mode, but the main one is the box model. In short, in quirks mode, the size of an element (ie it's height and width) include the border and margin, whereas in standards mode it doesn't.

There are whole range of other differences between the two modes, but that is the one which really causes the worst broken page layouts.

It sounds like your site was designed with quirks mode in mind, and not standards mode. Unfortunately, there's not much you can do to automate fixing it up; you'll just have to go through all your styles adjusting the positioning and sizing till it works.

You should also make sure that you have a valid Doctype declaration at the top of your HTML code. This will help the browser pick the correct rendering mode. Without it, you may find you still drop into quirks mode at times.

I would strongly recommend that you test the site in other browsers such as Chrome and Firefox. This is likely to help you by picking up other bugs in the code which IE8 may not have a problem with. I'd suggest doing this even if the end users only plan to use IE8, because as I say, they will almost certainly be upgrading to IE9 in the not-too-distant future, and IE10 not too long after that. IE9 is much more standards-compliant than IE8, and IE10 will be too, which means that if a page renders well in Chrome and Firefox then you should have some confidence that it will be okay in IE9 and IE10 when it is launched. This will save you from having a repeat of the IE6->IE8 problems in a year's time.

Hope that helps.

If you have any specific bits of code that you would like more help with, I'd suggest posting it here under a new question.

瞄了个咪的 2024-11-09 16:46:38

设计用于 IE6

是你的问题。 IE6 从来都不是一个标准很强的浏览器,因此 HTML 很可能包含许多专有的变通办法 - 升级表明这些实际上是多么糟糕。

看看这里,以滑稽的方式展示 IE6 有多“好”。

您可以:

  • 修复网站(强烈推荐
  • 告诉客户继续使用 IE6

即使您是初学者,您也应该能够适当修改 HTML 来解决此问题。

designed to be work in IE6

This is your problem. IE6 was never a browser strong on standards and so it is likely the HTML contains many propriety work arounds - upgrading is showing just how awful these actually are.

Take a look here for a comical take on just how "good" IE6 was.

You can either:

  • Fix the website (highly recommended)
  • Tell the customer to stay with IE6

Even if you are a beginner you should be able to modify the HTML appropriately to fix this problem.

多孤肩上扛 2024-11-09 16:46:38

我希望 CSS 样式已应用在单独的样式表中,而不是内联样式表中。 如果它是内联的,您最好的选择是从头开始正确地重新开发这些页面。其他表明您的 HTML 良好并且不需要焦土策略的线索:

  • 格式良好(正确闭合的标签,在 html 属性周围使用引号)
  • 使用 DIV 和 SPAN 进行布局,而不是到处使用 TABLE
  • 您有一个 DOCTYPE每个页面的顶部

如果运气好并且样式与内容分开,一种方法是创建一个全新的样式表,然后使用它使页面在 IE8 / Firefox 中看起来正确/ 野生动物园。然后,您可以使用条件注释恢复为 IE6 的旧样式表。

I'm hoping that CSS style has been applied in a separate stylesheet, not inline. If it is inline, your best bet would be to redevelop those pages properly from scratch. Other clues that your HTML is good and doesn't need a scorched-earth policy:

  • It's well formed (properly closed tags, use of quotes around html attributes)
  • Use of DIVs and SPANs for layout, rather than TABLEs everywhere
  • You have a DOCTYPE at the top of every page

If luck is on your side and style has been kept separate from content, an approach would be to create a brand new stylesheet, which you then use to make the pages look correct in IE8 / Firefox / Safari. You can then use Conditional Comments to revert back to the old stylesheet for IE6.

万水千山粽是情ミ 2024-11-09 16:46:38

作为临时解决方法,您可以告诉客户查看 兼容模式(您甚至可以通过从服务器发送元标记/标头来强制该模式)。虽然这可能无法解决您的所有问题,但它应该涵盖大多数问题。

从永久解决方案开始,您应该开始将页面逐一迁移到标准模式(即支持当前主流浏览器,如 IE8/9、FF、Chrome、Safari)

As a temporary work-around, you can tell your customers to view the web site in compatibility mode (you can even force the mode by sending meta tags/headers from server). Although, this may not fix all your issues, it should cover most of them.

From permanent solution, you should start migrating your pages one by one to standards mode (i.e. supporting current major browsers such as IE8/9, FF, Chrome, Safari)

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