views:

949

answers:

3

I have developed a html file. It is working fine in IE6 and IE7. When I run the same html file in IE8, the design is not the same and the Javascript is not working properly. It is showing browser's "Compatibility view"?

How do I fix this?

+4  A: 

It is difficult to really help you as you are not giving us enough information. Your question is very broad in the sense that getting your website to display the same in all browsers is a lot of work and the reasons why a particular layout is not working in a particular browser are just about infinite.

A few important things to get you started on your journey, though:

  • Use a DOCTYPE or you'll throw browsers into quirks mode.
  • Reset your CSS so you can apply the styles you want to elements.
  • Use a Javascript library - the popular one around these parts is jQuery, and it is the one I personally recommend. However, it doesn't really matter which one you go with as long as you use one. A lot of smart guys have put a lot of hours into taking care of all the incompatibilities between browsers. Trying to do a lot of dynamic stuff on your website with pure Javascript is bordering on masochistic.

Once I started doing these things, making my site work the same across browsers got a whole lot easier.

Paolo Bergantino
+1  A: 

Give this a read, it details the things that cause IE8 to switch to compatibility mode, and how to fix them.

http://blogs.msdn.com/ie/archive/2009/03/12/site-compatibility-and-ie8.aspx

Mike Robinson
A: 

You must give us some example codes (or even working website) and do something like:

  1. Website validation (html markup, css and javascript)
  2. Test it on another modern browser (opera, firefox, chrome, safari, etc)
  3. Do you adhere to web standard when building web?
  4. Do you rely on CSS hacks?
  5. Did you know that Trident rendering engine on IE6 & IE7 didn't even pass ACID 2 test? which mean have a lot troubles with CSS implementation...

Then we might be can help you

Dels