15

I need to force IE8 to display as follows:

  1. Browser Mode: Internet Explorer 8

  2. Document Mode: IE8 Standards

I have added this tag however it only affects the document mode, not the browser mode. How do I override browser mode to ensure the page is always shown with IE8 browser mode too?

<meta http-equiv="X-UA-Compatible" content="IE=8" />
slugster
  • 49,403
  • 14
  • 95
  • 145
user23048345
  • 3,033
  • 7
  • 31
  • 31
  • 1
    The browser mode is IE8 Compatibility View, but I need it just to be IE8. Changing the doctype has made no difference to this but I have noticed that the compatibility view setting for "Display Intranet Sites in Compatibility View" is ticked. It's an intranet site. – user23048345 Nov 12 '09 at 13:32
  • X-UA-Compatible should override that. Whereabouts in the is it set? It needs to be very near the top. – Olly Hodgson Nov 12 '09 at 14:11

6 Answers6

12

Just give the HTML page the right doctype. E.g.

<!doctype html>

For an explanation and overview of all doctypes see http://hsivonen.iki.fi/doctype/. You don't necessarily need those (nasty) meta headers.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • the doctype is ok, it's ie8 standards... the browser mode is wrong – user23048345 Nov 12 '09 at 13:33
  • Then the problem lies somewhere else. You need to elaborate more about it. What problem do you exactly have for which you think to solve with setting the "browser mode"? Please edit your question accordingly. – BalusC Nov 12 '09 at 14:00
  • My website works fine in standards compliant browsers (tested ok in chrome, firefox, opera) but IE is a nightmare. Because the web application is javascript intensive we're not supporting IE7 and have developed it for IE8 standards mode, so I need it only to display in IE8 standards mode. – user23048345 Nov 12 '09 at 14:29
  • 1
    The strict doctype should already display IE6/7/8 in standards mode. Your problem lies somewhere else. Concentrate on the Javascript corner. Post a the question in the Javascript context, not in the webbrowser context. – BalusC Nov 12 '09 at 14:31
  • 8
    The answer is correct, but his problem is likely that he has the 'Display intranet sites in Compatibility View' box checked under Page->Compatibility View Settings and he's looking at it through a local network, I was experiencing the same thing – Ruan Mendes Jan 19 '11 at 20:21
  • Is that the default? `Display intranet sites in Compatibility View`. I have the same issue. Will regular users automatically see it in Compatibility View? – Rondel Dec 13 '11 at 20:01
  • @JuanMendes So, as I'm designing a site on an intranet, and IT has enabled the Display intranet sites in Compatibility View (or maybe it's the default) is there anything that can be done about getting the page to render in IE8 Standards? – jonathanbell Jun 25 '13 at 20:33
2

As I understand it, the meta element you've posted tells the browser to use IE8 mode.

Using a strict doctype, e.g. <!DOCTYPE html> or <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> will tell the browser to render in standards mode.

A combination of the two will render the page in IE8 Standards mode.

Olly Hodgson
  • 15,076
  • 3
  • 40
  • 60
  • Is the X-UA-Compatible metatag the first item after the element? It needs to be very near the top of the to have any effect. – Olly Hodgson Nov 12 '09 at 14:05
  • 1
    Also, have a look at the options under Tools > Compatibility View Settings, make sure it's not running all "intranet" websites in compatibility mode. – Olly Hodgson Nov 12 '09 at 14:07
  • It is running all intranet websites in compatibility mode, that's a default group policy setting for all PCs on the network. Also yes the meta tag is just below the title element. – user23048345 Nov 12 '09 at 14:27
1

The problem resides in the historic battle between developers and Microsoft, and Microsoft's horrifically bad SharePoint Product line. Here is some history http://www.siolon.com/blog/ie-8-compatibility-mode-and-sharepoint/. (Not My Site) Basically IE renders, by default, all Intranet web pages in compatibility mode thus forcing all intranet sites to be no better then IE7. They probably did this because SharePoint is not web standards compliant and MS wanted their product to appear to work well on the corporate intranet sites where Sharepoint was already entrenched. I have a huge issue with this problem on a SharePoint site I am currently working on. Sharepoint uses the SharePoint:CssLink tag to dynamically load css files depending on browser. So while our site is designed for IE9, the IE7.css style sheet is sent to the page because the browser reports itself as an IE7 browser. The only solution in my estimation is to not use IE or design with IE in mind or to use SharePoint. If MS is forced to use web standards just to gain traffic on their platforms, then we might get them to change.

Daniel Byrne
  • 1,411
  • 15
  • 12
1

It's impossible because the browser mode is determined before sending the request.

emk
  • 221
  • 3
  • 4
1

It's impossible because the browser mode is determined before sending the request.

This is right, I read microsoft documentation, see below:

An important detail to remember is that Browser Mode is chosen before IE requests web content. This means that sites cannot choose a Browser Mode. Instead site developers choose a Document Mode for their site, which overrides IE’s defaults and declares how a website is rendered.

But for some reason, my functions doesn't work properly if the browser is under IE-8 compat view. Even I have set the document mode correctly to IE8 Standards.

Koigokoro
  • 31
  • 3
0

If you just need to change how it displays locally, you can use the Developer Tools. Press F12 (or choose Developer Tools from the Tools menu). There will be a menu item for both "Browser Mode", and "Document Mode". The change is dynamic and I believe the it will stay for the life of the session.

tlbradshaw
  • 21
  • 1