简体   繁体   English

为什么我的页面在IE9的IE7模式下工作,而在IE7本身却没有?

[英]Why does my page work in IE9's IE7 mode, but not in IE7 itself?

I recently went live with our new home page, after heavily testing it in each of IE9's browser and document modes ( not just compatibility mode, but actual IE7 and IE8 emulation). 我最近去我们的新主页生活,以后的各IE9中的浏览器和文档模式大量测试它( 只是兼容模式,但实际的IE7和IE8仿真)。 The site works in each mode, not to mention modern browsers. 该网站适用于每种模式,更不用说现代浏览器了。 However, after it launched I got an email that said the site was very broken in IE7. 然而,在它发布后,我收到一封电子邮件,说该网站在IE7中非常破碎。 I went to an abandoned machine and booted up Windows XP, started IE7, and loaded the page. 我去了一台废弃的机器并启动了Windows XP,启动了IE7并加载了该页面。 To my horror, the layout was indeed broken! 令我惊恐的是,布局确实破了! (NOT just the slideshow!) (不只是幻灯片!)

Most importantly, why does my page not work in IE7, even though it works in IE7 mode in IE9? 最重要的是,为什么我的页面在IE7中不起作用,即使它在IE9中的IE7模式下工作? And as a secondary question, what might be "wrong" with it? 作为第二个问题,它可能是“错误的”?

Edit : I have figured out that one of my problems may be the slideshow, but adding .ie7 #slideshow {display:none !important} won't even hide the slideshow. 编辑 :我已经发现我的一个问题可能是幻灯片,但添加.ie7 #slideshow {display:none !important}甚至不会隐藏幻灯片。 I can't access it via CSS. 我无法通过CSS访问它。

Edit 2 : There is another problem that only shows up in native IE7 -- the footer on that home page, and this page , is ultra-tiny text that can't be zoomed. 编辑2 :还有另一个问题只出现在原生IE7中 - 该主页上的页脚和此页面是无法缩放的超小文本。 It doesn't do this in IE9's IE7 mode (not compatibility), or in any other browser. 它不能在IE9的IE7模式(不兼容)或任何其他浏览器中执行此操作。 Another example of the discrepancy. 另一个例子就是差异。

I don't know about IE9's IE7-compatibility mode but the IE7-compatiblity mode built into IE8 is well known for not being a perfect copy of a real IE7. 我不知道IE9的IE7兼容模式,但IE8内置的IE7兼容模式众所周知,因为它不是真正的IE7的完美副本。 It has a large number of bugs and quirks of its own which do not appear in normal IE7. 它有大量的bug和怪癖,它们不会出现在正常的IE7中。

It was bad enough that I would never have recommended anyone to actually use compatibility mode to test their site... except that you still need to cope with the occasional user who is actually using compatiblity mode on their live browser. 这是非常糟糕的,我永远不会建议任何人实际使用兼容模式来测试他们的网站...除了你仍然需要应对实际上在他们的实时浏览器上使用兼容模式的偶尔用户。 So rather than making things easier for the developer, MS actually made things harder for us by adding yet another possible rendering engine to the mix which. 因此,MS并没有为开发人员提供更多便利,而是通过添加另一个可能的渲染引擎来实现更加困难。 Sigh. 叹。

I haven't tried IE9's compatibility modes, but if your experience is anything to go by, then they've still got the same problem. 我还没有尝试过IE9的兼容模式,但是如果你的经验是可以接受的,那么他们仍然会遇到同样的问题。 It's a shame (but not surprising) that MS didn't learn from the first time they made that blunder. MS没有从第一次犯错误中吸取教训,这是一种耻辱(但并不奇怪)。

Rather than using compatibility modes to test, the best solution I know of is to use an application called IE Tester , which allows you to install and run all versions of IE alongside each other. 我不知道使用兼容模式进行测试,我知道的最佳解决方案是使用名为IE Tester的应用程序,它允许您同时安装和运行所有版本的IE。 It's still not perfect (the only way you'll get perfect, as you've already discovered, is to have a real IE7 on its own real copy of XP), but it is much much closer to the real thing than IE's own 'compatiblity' mode. 它仍然不是完美的(你已经发现,唯一可以完美的方法就是拥有一个真正的IE7自己的真实副本),但它比真正的IE更接近真实的东西。兼容性模式。

I would recommend using the HTML5BoilerPlate ( http://html5boilerplate.com/ ) as a source of inspiration and guidance. 我建议使用HTML5BoilerPlate( http://html5boilerplate.com/ )作为灵感和指导的来源。 I am in the exact same situation: Web Developer for a university and have to write a main site redesign. 我处于完全相同的情况:一个大学的Web开发人员,必须写一个主站点重新设计。

I think you already did this, based on your source. 我想你已经根据你的来源做了这个。 Are you using the latest version? 你使用的是最新版本吗? Perhaps there have been some updates to the HTML5BoilerPlate template that would address this. 也许HTML5BoilerPlate模板有一些更新可以解决这个问题。

I found a co-worker with the real IE7 installed and sure enough, your page looks bad. 我发现安装了真正的IE7的同事,果然,你的页面看起来很糟糕。 I then checked out my mockup in the real IE7 and it looks OK (I consider my very lucky now). 然后我在真正的IE7中检查了我的模型,它看起来很好(我认为我现在非常幸运)。

My mockup is also based on the HTML5BoilerPlate template. 我的模型也基于HTML5BoilerPlate模板。

Another suggestion is to try commenting-out blocks of code and try to isolate the cause of the problem. 另一个建议是尝试注释掉代码块并尝试找出问题的原因。

I think you slideshow is the cause of the problem (or at least the symptom). 我认为你幻灯片是问题的原因(或至少是症状)。 I have had to re-implement my slideshow content using 3 different plugins. 我不得不使用3种不同的插件重新实现我的幻灯片内容。 Currently, I have settled on the jQuery cycle plugin for that kind of content: http://jquery.malsup.com/cycle/ 目前,我已经为这种内容确定了jQuery循环插件: http//jquery.malsup.com/cycle/

I really want to know the cause the of the problem, too. 我也非常想知道问题的原因。 The site looks great, by the way, when rendered the way it is supposed to look. 顺便说一句,该网站看起来很棒,当它呈现它看起来的方式。 Good job! 做得好!


Checkout this MSDN blog posting: http://blogs.msdn.com/b/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx 查看此MSDN博客文章: http//blogs.msdn.com/b/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx

The problem seems to be with the slideshow 问题似乎与幻灯片显示有关

Glancing through your script.js file i see this 浏览你的script.js文件,我看到了这一点

/*
 * Here is the slideshow code.
 */

 // Screw ie7...
if ( !($.browser.msie && $.browser.version <= 7.0) ){

so i would start my search there, as it seems to ignore IE7 and below.. 所以我会在那里开始我的搜索,因为它似乎忽略IE7及以下..

Download the free Microsoft Virtual PC and MS's free Hard Drive images containing IE 7, 8, etc... that's why they make these available. 下载包含IE 7,8等的免费Microsoft Virtual PC和MS 免费硬盘图像 ...这就是他们提供这些图像的原因。

There seems to be a million jQuery slideshow plugins and most are compatible with IE 7. 似乎有一百万个jQuery幻灯片插件,大多数都与IE 7兼容。

jCarousel is one and you can change it with CSS to look like what you have now. jCarousel是一个,你可以用CSS改变它看起来像你现在拥有的。

This page contains 42 various slide-show plugins. 此页面包含42种各种幻灯片插件。


EDIT: 编辑:

I also recommend that the page be brought into W3C compliance before tackling the other issues. 我还建议在解决其他问题之前将该页面纳入W3C合规性

我建议您使用XP Mode避免仿真方法并在机器上的实际IE7中进行测试。

First: always test on the actual browser. 第一:始终在实际浏览器上进行测试。 If we're talking about ie, use a virtual machine to test it. 如果我们正在谈论ie,请使用虚拟机来测试它。 Never rely on "compatibility modes", "ies4linux", "ies4mac", "just use wine" and such. 永远不要依赖“兼容模式”,“ies4linux”,“ies4mac”,“只是使用葡萄酒”等。 I've had a lot, but a LOT of headaches when not using virtual machines (you can use snapshots on your virtual machines - each snapshot is a browser version. This way you can have only one image but with multiple browsers). 我有很多,但是在不使用虚拟机时会有很多麻烦(你可以在你的虚拟机上使用快照 - 每个快照都是浏览器版本。这样你只能有一个图像但有多个浏览器)。

Second: do this problem happens even if you remove that slideshow section from your script.js? 第二:即使你从script.js中删除了幻灯片部分,也会发生这个问题吗? Did you check if, after removing that section and reloading your page if it isn't a cached version of the old script.js? 在删除该部分并重新加载页面后,如果它不是旧script.js的缓存版本,您是否检查过? Sometimes a cached version is the source of all problems. 有时缓存版本是所有问题的根源。

A little hack to fool your browser into not caching script.js is to add, when calling script.js from your markup, an arbitrary number (script.js?v=100 for example, and for each modification you do with your js, you modify this number. You can check SO's source, it uses a similar approach in some sections). 有点骇客欺骗你的浏览器不缓存script.js是在从你的标记调用script.js时添加一个任意数字(例如,script.js?v = 100,对于你用你的js进行的每次修改,你可以修改这个数字。你可以检查SO的来源,在某些部分使用类似的方法)。

Third: try to do, before the "negation" in your script: 第三:尝试在脚本中的“否定”之前做:

alert($.browser.msie);
alert($.browser.version);
alert($.browser.msie && $.browser.version <= 7.0);

...and see if ie alerts something or if it raises an exception. ...并查看ie是否发出警告或是否引发异常。 Sometimes ie will try to interpret your javascript, and raise an unknown exception for no reason whatsoever: if you don't catch it in a try/catch block everything will break from that point to the end of the script. 有时ie会尝试解释你的javascript,并无缘无故地引发一个未知的异常:如果你没有在try / catch块中捕获它,那么一切都会从那一点到脚本结束。

I know, it's a trial-and-error approach, but we have to isolate everything and try to understand exactly what's causing the error. 我知道,这是一种试错法,但我们必须隔离所有内容并尝试准确理解导致错误的原因。 If needed, repeat the third advice along the slideshow section. 如果需要,请在幻灯片部分重复第三条建议。

Alrgiht, this maybe the answer ur looking for. Alrgiht,这可能是你寻找的答案。 Go to F12 developer tools and click IE9 browser mode and IE7 document mode It will be IE7 standards, but a IE9 useragent. 转到F12开发人员工具并单击IE9浏览器模式IE7文档模式它将是IE7标准,但是IE9使用者。 If that doesn't work, try using IE7 browser mode and document mode. 如果这不起作用,请尝试使用IE7浏览器模式和文档模式。

I'm with the others in saying that the possible culprit is the slideshow. 我和其他人说,可能的罪魁祸首是幻灯片。 I would get a more CSS friendly slideshow: 我会得到一个更友好的CSS幻灯片:

http://flowplayer.org/tools/index.html http://flowplayer.org/tools/index.html

And definitely test in the ACTUAL browser! 并且肯定在ACTUAL浏览器中测试! You could use an online browser check site like browsershots.org. 您可以使用browsershots.org等在线浏览器检查网站。 They take aLONG time to produce a shot of your site, but it is accurate. 他们花了很长时间来制作你网站的镜头,但这是准确的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM