Content by Category
.NET 1.x
.NET 2.0
.NET 3.0
.NET 3.5
.NET 4.0
.NET 4.5
.NET Assemblies
.NET Framework
.NET Getting Started
Accessibility
ADO.NET
Advertorials
Agile Development
AJAX
Amazon Web Services
Analysis Services
Android
Architecture
Arduino
ASP .NET Web API
ASP.NET
ASP.NET MVC
ASP.NET WebForms
Azure
B2B (Business Integration)
BDD
Big Data
Bing
BizTalk
Book Excerpts
Build and Deploy
Business Intelligence
C#
C++
ClickOnce
Cloud Computing
Code Contracts
CODE Framework Info - non Technical
CODE on the Road!
COM+
Community
Conferences
Continuous Integration
Crystal Reports
CSLA.NET
CSS
Data
Debugger
Design Patterns
Development Process
Display Technologies
Distributed Computing
Document Database
DotNetNuke
DSL
Dynamic Languages
Dynamic Programming
Editorials
Enterprise Services ("COM+")
Entity Framework
Events
Expression Blend
F#
Fox to Fox
Frameworks
Functional Programming
Git
Graphics
HTML 5
Internet Explorer 8.0
Interviews
IOS
iPhone
Iron Ruby
Java
Java Script
JavaScript
jQuery
JSON
Lightswitch
LINQ
Linux
LUA
Mac OS X
MDX
Messaging
Metro
Microsoft Application Blocks
Microsoft Business Rules Framework
Microsoft Dynamics
Microsoft Expression
Microsoft Office
Mobile Development
Mobile PC
Mono
MsBuild
MVVM
MySQL
Network
NHibernate
node.js
NOSQL
Nuget
Object Oriented Development
Objective C
Odata
OLAP
Open Source
Opinion
Opinions
Oracle
ORM
Other Languages
Parallel Programming
Patterns
PHP
Podcasts
Post Mortem
PowerPoint
Print/Output
Prism
Product News
Product Reviews
Project Management
Prolog
Python
Q&A
Rails
Rake
Razor
Reporting Services
REST
RIA Services
Ruby
Ruby on Rails
Scheme
Search
Security
Services
SharePoint
SignalR
Silverlight
SOA
Social Networks
Software & Law
Software Business
Source Control
Speech-Enabled Applications
SQL Server
SQL Server 2000
SQL Server 2005
SQL Server 2008
SQL Server 2012
SQL Server CE/AnyWhere/Mobile/Compact
SSIS
Subversion
Sync Framework
Tablet PC
TDD
Team System
Techniques
Testing and Quality Control
TFS
Tips
TypeScript
UI Design
UML
User Groups
VB Script
VB.NET
Version Control
VFP and .NET
VFP and SQL Server
Virtual Earth
Vista
Visual Basic
Visual Basic 6 (and older)
Visual FoxPro
Visual Studio .NET
Visual Studio 11
Visual Studio 2005
Visual Studio 2008
Visual Studio 2010
Visual Studio 2011
Visual Studio 2012
Visual Studio Tools for Office
VSX
WCF
Web Development (general)
Web Services
WebMatrix
WF
Whitepapers
Windows 7
Windows 8
Windows Azure
Windows Live
Windows Phone 7
Windows Phone SDK
Windows Server
Windows Vista
WinForms
WinRT
Workflow
WPF
XAML
Xiine Documentation
XML
XNA
XSLT



Component One


LearnNow
 


Component One

Reader rating:
Click here to read 5 comments about this article.
Article source: CoDe (2008 - Vol. 5 - Issue 3 - IE8)

Introducing Compatibility View

Compatibility View allows access to content designed for older Web browsers. When a website says that it supports modern Web standards, Internet Explorer 8 Beta 2 respects that and displays the site using its most standards compliant mechanism. In the majority of cases, this works out just fine. However, every once in a while, a page that says “display me using modern standards” really means “display me like Internet Explorer 7 used to display modern standards pages”. This is where Compatibility View comes in.

To set the stage, let me begin with a quick, overly simplified view of Web content. There are a set of rules which determine how websites should be displayed. Internet Explorer 8 Beta 2 follows a set of rules as defined in modern Web standards.

A ton of existing pages on the Web-the majority, actually-were developed with either no concept of these modern Web standards (developers just didn’t know or care) or were authored pre-standards (yes, there are plenty of pages that old still in use today). These older, non-standard pages work just great in Internet Explorer 8 Beta 2 as they depend on behavior that has been included in the browser for quite some time and hasn’t dramatically changed release to release.

As you might expect, there’s also a large number of pages authored according to modern Web standards and the trend is that standards mode pages will soon become the majority. Unfortunately, there are differences between modern browsers and older browsers in the level and type of standards support they provide. New standards have emerged; existing standards have been clarified; bugs have been filed.

Think of this as no different than the gasoline you pump into your car each week. At one point in time, leaded fuel was the standard. Then came unleaded. Diesel is the standard in trucks, but is also used in some cars. And, going forward, who knows-maybe alternative fuels? In any case, an original Ford Model-T supports a different fuel type than modern day Ford models.

It follows then that there are differences in standards support between browser versions. For example, Internet Explorer 8 Beta 2’s support for modern Web standards is different than Internet Explorer 7’s support for modern Web standards. Thankfully, just about every site written according to modern standards works in Internet Explorer 7 today. Some, but not all, of these will work in Internet Explorer 8 Beta 2 by default. But, there is a small class that won’t. Compatibility View allows access to this content by making the browser emulate Internet Explorer 7 behaviors when displaying Web pages.

Internet Explorer 7 Compatibility View

Three elements make it possible for Internet Explorer 8 Beta 2 to look and act like Internet Explorer 7 when displaying Web content.

The first of these is Layout mode, the set of HTML, CSS, and DOM rules used by the browser when evaluating markup and placing elements on the screen. Internet Explorer 8 Beta 2 ships with a Layout mode equivalent to Internet Explorer 7 Standards mode. When in Compatibility View, Internet Explorer evaluates pages that would normally trigger Internet Explorer 8 Standards mode, the latest and most standards compliant Layout mode, as mapping to Internet Explorer 7 Standards mode.

The second is User Agent string. When you visit a Web page, your browser sends a User Agent string to the server that hosts the content. This string indicates which browser you are using, its version number, and details about your system such as operating-system version. The Web server can use this information to provide content that is tailored to your specific browser. In Compatibility View, Internet Explorer 8 Beta 2 sends a User Agent string indicating a browser version of ‘7’ -

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0;
   Trident 4.0;)

A new token indicates the underlying Trident engine version and serves as a signal that Internet Explorer 8 Beta 2 is running in Internet Explorer 7 Compatibility View.

The final element is version vector, which is used in the evaluation of Conditional Comments. Conditional Comments are “if” statements within your HTML. The code contained within a conditional comment block is only exercised if the expression evaluates to TRUE. The expression generally takes the form of a declared Internet Explorer version value and a comparison is performed against Internet Explorer’s Version Vector registry key.

To recap, when Compatibility View is enabled:

  • Standards mode pages map to Internet Explorer 7 Standards mode pages (Quirks pages still map to Quirks mode)
  • The User Agent string indicates a version of ‘7’
  • The Version Vector, used in the evaluation of Conditional Comments, indicates a version of ‘7’

Putting the User in Control

A new UI button controls the Compatibility View feature. The button is located in the navigation bar just to the right of the Address bar (next to the refresh button, see Figure 1) and it only displays when toggling into Compatibility View makes sense such as when viewing Standards mode pages. In all other cases, such as when viewing Quirks mode pages, viewing intranet sites (they’re already being displayed in Compatibility View as explained later), or viewing sites with a <META> tag / HTTP header indicating Internet Explorer 7 or Internet Explorer 8 Standards, the button is hidden.

Click for a larger version of this image.

Figure 1: Compatibility View button.

Depending on the speed of your machine, you may see the page refresh when the Compatibility View button is selected. In any case, a balloon tip lets you know that the site is now running in Compatibility View. Additionally, the Compatibility View icon shows a “pressed” state so that you can know what view you’re running in after the balloon tip disappears.

The “scope” of emulation is limited to the domain you are viewing when you press the button, not some other mechanism like the life of the process or the tab. And, Internet Explorer remembers your button press so that the next time you visit the site you don’t have to press the button again.

Compatibility View and Local Intranet

A large number of line-of-business websites located on corporate intranets are Internet Explorer 7 capable today, but may not be Internet Explorer 8 Beta 2 capable by default. In order to preserve compatibility, Internet Explorer 8 Beta 2 ships with smart defaults based on zone evaluation. In the default state, all Internet websites display in Internet Explorer 8 Standards mode (Compatibility View off) and all intranet websites display in Internet Explorer 7 Standards mode (Compatibility View on).

Let’s look at some examples.

If you navigate to sites on the Internet like www.msn.com and www.live.com, Compatibility View is off by default. Internet Explorer 8 Beta 2 identifies itself with a User Agent string of ‘8’, Version Vector of ‘8’ and displays Web pages that trigger standards mode in Internet Explorer 8 Standards mode. The same is also true if you navigate by IP address, such as http://192.168.0.1. As Internet Explorer can’t tell offhand whether the IP address is internal or external, it assumes the latter. Use Compatibility View to fix problems with websites in this category.

If you navigate to sites on the intranet like http://myPortal and http://sharepoint/sites/mySite Internet Explorer 8 Beta 2 identifies itself with a User Agent string of ‘8’, Version Vector of ‘7’, and displays Web pages that trigger Standards mode in Internet Explorer 7 Standards mode.

A new entry in the Tools menu allows for advanced configuration of the feature. You can make it so that all intranet sites display in Internet Explorer 8 Standards mode. You can also configure policy such that every site is viewed in Internet Explorer 7 Compatibility View (identical to the behavior from Internet Explorer 8 Beta 1 when the ‘Emulate IE7’ button was pressed). Lastly, you can pre-populate a list of sites (Figure 2) that should always be viewed in Compatibility View and/or edit the current entries.

Click for a larger version of this image.

Figure 2: Compatibility View Settings.

And, of course, all of the feature’s settings, including the advanced configuration options, are configurable via Group Policy and the Internet Explorer Administration Kit (IEAK).

Making Your Pages Work with Internet Explorer 8 Beta 2

The best way to ensure users have a great experience with your website, and thus don’t have to use the Compatibility View feature at all for Internet sites, is to test your site using Internet Explorer 8 Beta 2 and update it as necessary.

  1. Navigate to your website using Internet Explorer 8 Beta 2.
  2. If the pages work great, add the ‘EmulateIE8’ <META> tag / HTTP header. Doing so ensures that new site visitors will never see the Compatibility View button when viewing your site. Additionally, the <META> tag / HTTP header has the added benefit of “bringing back” those users who may have selected Compatibility View for your website before you had a chance to test and add the <META> tag / HTTP header. The tag / header forces Compatibility View off.
  3. If pages look differently than they did in Internet Explorer 7 or don’t work the same way, enable Compatibility View.
  4. If switching on Compatibility View makes your pages render and function as they do in Internet Explorer 7, then add the ‘EmulateIE7’ <META> tag / HTTP header to immediately get your site working.
  5. Long term, update your site to support Internet Explorer 8 Standards mode by authoring your page according to modern Web standards supported by Internet Explorer and including a Standards mode DOCTYPE.

For more information on using the <META> tag / HTTP header, see the article “Making Your Website Compatible Across Multiple Versions of Internet Explorer”.

Conclusion

Compatibility View is an end-user site compatibility mitigation option for gaining access to content built for older Web browsers. When a user leverages the feature for a particular website, components of the Internet Explorer subsystem-the User Agent String, the Version Vector, and Layout mode-change to resemble the way things were in Internet Explorer 7.

Unfortunately, most users will only discover the Compatibility View feature after they’ve had a less than stellar experience with a particular Internet facing website. You can prevent such an event from happening on your website by testing your pages in Internet Explorer 8 Beta 2.

Scott Dickens

&

By: Scott Dickens

Scott Dickens is a Lead Program Manager at Microsoft, based in Redmond, WA.

Scott works on several features of Internet Explorer including layout, versioning and modes, rendering, graphics and images, text, printing, zoom, and Web site compatibility.

sdickens@microsoft.com

Fast Facts

Local files such as ‘C:\Test.htm’ display in Internet Explorer 8 Standards mode (Compatibility View off).


WebOC Hosts

All components that host Trident, the Internet Explorer engine, are opted-in to Compatibility View by default. You can turn on Internet Explorer 8 Standards mode via the Feature Control Key FeatureBrowserEmulation.



How would you rate the quality of this article?
1 2 3 4 5
Poor      Outstanding

Tell us why you rated the content this way. (optional)

Average rating:
2.7 out of 5

30 people have rated this article.

Instantly Search Terabytes Of Text
“Lightning Fast”
– Redmond Mag
“Covers all data
sources” – eWeek
25+ fielded & full-text search options
dtSearch’s own document filters highlight hits in popular file types
Web Spider supports static & dynamic data
APIs for .NET, Java, C++, SQL, etc.
Win / Linux (64-bit & 32-bit)
www.dtSearch.com
 

      Component One

 

Xojo