03. august 2009 - 23:34 Der er 4 kommentarer

Frustrating: Can't force IE 8 into "Compatibility view"!!!

I've got two very different websites. Both of them have different errors when displayed in the "Internet explorer 8" browser mode!

When clicking the "Compatibility view" button next to the address bar both of the sites look great. When I afterwards look at the "Browser mode" and "Document node" by using the built-in "Developer tools", I also notice the "Browser mode" is "IE8 Compat view" and the "Document mode" is "IE7 Standards". Just as I expect them to be.

Then I want to force "Internet Explore 8" into the "Browser mode" : " IE8 Compat view", so that my users won't have to click the "Compatibility view" button next to the address bar to get what they really need to see.

The only way I can think of doing this is by inserting a metatag below the title inside the header like this:
   
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" lang="en">
        <head>
            <title>Test</title>
            <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
            <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
            <link ... />
            <script ...></script>
        </head>
        <body>
            ...
        </body>
    </html>

Then i reload the website and the "Compatibility view" button next to the address bar disapears. Just as expected. When I afterwards look at the "Browser mode" and "Document node" by using the built-in "Developer tools", I suddenly see something I really did NOT expect. I expected the "Browser mode" to be "IE8 Compat view" and the "Document node" to be "IE7 Standards", but the "Browser mode" is "IE8" and the "Document mode" is "IE7 Standards" and the websites suddenly have a new set of errors compared to when viewed in "Internet explorer 8" browser mode!

It is very frustrating why can't I force the "IE8 Compat view" browser mode instead of the "Internet explore 7" or "Internet explore 8" browser modes?
Avatar billede olebole Juniormester
04. august 2009 - 00:03 #1
<ole>

Can't you just write the CSS and markup code, so you don't have to do anything?

Btw: Do you remember to force the browser to send the document as application/xhtml+xml, so it won't default to text/html. XHTML 1.0 Strict should not be served as text/html.

And btw: Did you know, W3C has stopped the development of XHTML - and from now on only is focused on HTML? XHTML is dead on WWW.

/mvh
</bole>
05. august 2009 - 20:57 #2
"Can't you just write the CSS and markup code, so you don't have to do anything?"
No the idea was to easy and quickly tell IE8 that this site already work in IE7 and then I8 would just render it using IE7 standards instead. This should be possible by applying EmulateIE7.

"Btw: Do you remember to force the browser to send the document as application/xhtml+xml, so it won't default to text/html. XHTML 1.0 Strict should not be served as text/html."

Actually I mostly use this doctype. Sorry about that:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
And in this case I think "text/html" is appropiate to use according to "http://www.w3.org/TR/xhtml-media-types/"

"And btw: Did you know, W3C has stopped the development of XHTML - and from now on only is focused on HTML? XHTML is dead on WWW."
I don't agree on this. It's not dead before all the major sites stop using it. Right know almost everybody use it.
Avatar billede olebole Juniormester
06. august 2009 - 18:52 #3
You can not change the browsers compatibillity mode - but you can write your code in a way, that makes it compatible with modern browsers.

"Right know almost everybody use it." >> No only a very, very few sites actually use XHTML. A lot of ignorant coders believe, that they use XHTML without doing so - but that's quite another story  ;o)

XHTML 1.0 Transitional was intended to be a tool for practicing. A flavour of XHTML, that should only be used for a brief transitional period, while the coder learnt the new syntax.
XHTML was released in 1999, so the transition period should be over many years ago.

Furthermore XHTML 1.0 Transitional must always be parsed as HTML - never as X(HT)ML. Therefore noone or nothing on the entire globe bennefits from your so called 'XHTML' code.

Because the international web community for years have begged W3C to abbandon XHTML and focus on HTML5 instead, they have done so.

Wether a lot of major sites have had the time to switch to a future orientated standard or not ... XHTML will not be developed, but will forever stay as is. On my planet that equals death  =)
Avatar billede olebole Juniormester
06. august 2009 - 18:52 #4
"You can not change the browsers compatibillity mode with JavaScript"  ;o)
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester