пятница, 30 марта 2012 г.

Speed and Mobility: An Approach for HTTP 2.0 to Make Mobile Apps and the Web Faster

This week begins face to face meetings at the IETF on how to approach HTTP 2.0 and improve the Internet. How the industry moves forward together on the next version of HTTP – how every application and service on the Web communicates today – can have a positive impact on user experience, operational and environmental costs, and even the battery life of the devices you carry around.
As part of this discussion of HTTP 2.0, Microsoft will submit to the IETF a proposal for “HTTP Speed+Mobility.”  The approach we propose focuses on Web performance improvements at the same time it takes into account the important needs of mobile devices and applications.
You can read more here about this proposal and an approach to HTTP 2.0 which considers network speed, cost, and device battery life, and works for everyone from sites owners, content providers, to consumers.
-- Rob Mauceri, Group Program Manager, Internet Explorer

Launch Options for Internet Explorer 10 on Windows 8

IE10 is a new browsing experience built in lockstep with Windows 8 to give you all the advantages that Metro style applications offer. We built that experience by extending IE’s underlying architecture to provide a fast, fully hardware accelerated browsing engine with strong security and support for HTML5 and other Web standards. IE10 also includes a desktop experience for when you are using desktop tools and wish to continue using them in your existing workflows.
Following last September’s release of the Windows 8 Developer Preview, we heard a lot about giving you the option to control which experience of Internet Explorer—Metro style or on the desktop —to launch when clicking a link in another application. In the Windows Consumer Preview, IE10 offers you that control.
By default, Windows 8 Consumer Preview opens links using the flavor of Internet Explorer that matches your current environment: if you’re running a Metro style application, following a link launches Metro style IE10; if you’re running a desktop application, following a link launches IE10 on the desktop. You can override this default behavior using the Programs tab of the Internet Properties dialog.
Screen shot of the Programs tab of the Windows 8 Internet Properties dialog showing the option for choosing how Internet Explorer opens links.
You can locate these settings quickly by using the Start screen’s search capability and searching for terms such as “links,” “launch,” or “open links.” Show below is the result of search for the term “launch.”
Screen shot of a Settings section of the Windows 8 Start search results page when "launch" is searched for. "Choose how you open Internet Explorer" is selected in the search results.
The following sections describe the available settings.

Opening Links

The first setting of the Browser Launch Settings (labeled “Choose how you open links”) controls what happens when you click a link in another program. Your choices include:
Options for Opening Links Behavior
Let Internet Explorer decide Launch links based on the environment you are in
Always in Internet Explorer Launch links in the Windows 8 (Metro style) environment
Always in Internet Explorer on the desktop Launch links in the desktop environment
The default for this setting is “Let Internet Explorer decide.” In other words, links will launch into the appropriate experience based on the invoking context—desktop or Metro style. Links will open in the desktop IE10 when a link is clicked from a desktop application, for example, Microsoft Word, and in Metro style IE10 when a link is opened from a Metro style application.

Opening Internet Explorer from the Start Screen

In addition to controlling how Windows opens links, the Browser Launch Settings also provide users with options on how Internet Explorer application tiles launch from the Start screen. Internet Explorer’s application tile is the default launching point for the browser on the Start screen. You create pinned site tiles when you pin sites to the Start screen. The setting “Open Internet Explorer tiles on the desktop” controls what happens when you click the Internet Explorer or pinned site tile.
Options for opening Internet Explorer Tiles Expected behavior
(unchecked) Launch in the Windows 8 (Metro style) environment
(checked) Launch in the desktop environment

Launch Options and Browser Defaults

IE10 is available in both Metro style and desktop experiences when it is the default browser. If Internet Explorer is not your default browser, only desktop IE is available and you cannot change IE’s Browser Launch Settings. The “Choose how you open links” option on the Programs tab of the Internet Properties dialog will be disabled (“grayed out”) when IE is not the default browser:
Screen shot of the Programs tab of the Windows 8 Internet Properties dialog showing the option for choosing how Internet Explorer opens links disabled because IE10 is not the default browser.
To change the default browser, type “default” on the Windows 8 Start screen. The Start screen will search apps, settings, and files for this term. The Apps results will include Default Programs. Touch or click it to bring up the Default Programs control panel item. From its list of options, select “Set your default programs” to display a page containing a list of programs on the left.
Screen shot of the Set Default Programs control panel item showing "Internet Explorer" selected in the list of programs and "Set this program as default" being selected.
Select “Internet Explorer” and then click or touch “Set this program as default.” This will set IE10 as the default browser on Windows 8 and enable its Metro style experience.

Conclusion

IE10 offers you a full-screen, immersive site experience. We’ve found that many people – even those with the most enthusiastic and intense browsing patterns – prefer Metro style browsing because it’s less manual and more focused on what you browse than on how you browse. That said, for some browsing, IE on the desktop continues to play an important role. The Browser Launch Settings allow you to change the default settings for a “no compromises” experience.
Try out these settings, and let us know what you think. We look forward to your feedback here and on Connect.
—Kevin Luu, Program Manager, Internet Explorer

воскресенье, 25 марта 2012 г.

WebSockets in Windows Consumer Preview

In Windows 8 Consumer Preview and Server Beta, IE10 and all other Microsoft WebSocket client and server features now support the final version of the IETF WebSocket Protocol. In addition, IE10 implements the W3C WebSocket API Candidate Recommendation.
WebSockets are stable and ready for developers to start creating innovative applications and services. This post provides a simple introduction to the W3C WebSocket API and its underlying WebSocket protocol. The updated Flipbook demo uses the latest version of the API and protocol.
In my previous post, I introduced WebSocket scenarios:
WebSockets enable Web applications to deliver real-time notifications and updates in the browser. Developers have faced problems in working around the limitations in the browser’s original HTTP request-response model, which was not designed for real-time scenarios. WebSockets enable browsers to open a bidirectional, full-duplex communication channel with services. Each side can then use this channel to immediately send data to the other. Now, sites from social networking and games to financial sites can deliver better real-time scenarios, ideally using same markup across different browsers.
Since that September 2011 post, the working groups have made significant progress. The WebSocket protocol is now an IETF proposed standard protocol. In addition, the W3C WebSocket API is a W3C Candidate Recommendation.

Introduction to the WebSocket API Using an Echo Example

The code snippets below use a simple echo server created with ASP.NET’s System.Web.WebSockets namespace to echo back text and binary messages that are sent from the application. The application allows the user to type in text to be sent and echoed back as a text message or draw a picture that can be sent and echoed back as a binary message.
Screen shot of WebSockets echo sample application.
For a more complex example that allows you to experiment with latency and performance differences between WebSockets and HTTP polling, see the Flipbook demo.

Details of Connecting to a WebSocket Server

This simple explanation is based on a direct connection between the application and the server. If a proxy is configured, then IE10 starts the process by sending a HTTP CONNECT request to the proxy.
When a WebSocket object is created, a handshake is exchanged between the client and the server to establish the WebSocket connection.
Diagram illustrating an HTTP GET Upgrade Request from an HTTP Client to an HTTP Server.
IE10 starts the process by sending a HTTP request to the server:
GET /echo HTTP/1.1
Host: example.microsoft.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Origin: http://microsoft.com
Sec-WebSocket-Version: 13
Let’s look at each part of this request.
The connection process starts with a standard HTTP GET request which allows the request to traverse firewalls, proxies, and other intermediaries:
GET /echo HTTP/1.1
Host: example.microsoft.com
The HTTP Upgrade header requests that the server switch the application-layer protocol from HTTP to the WebSocket protocol.
Upgrade: websocket
Connection: Upgrade
The server transforms the value in the Sec-WebSocket-Key header in its response to demonstrate that it understands the WebSocket protocol:
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
The Origin header is set by IE10 to allow the server to enforce origin-based security.
Origin: http://microsoft.com
The Sec-WebSocket-Version header identifies the requested protocol version. Version 13 is the final version in the IETF proposed standard:
Sec-WebSocket-Version: 13
If the server accepts the request to upgrade the application-layer protocol, it returns a HTTP 101 Switching Protocols response:
Diagram illustrating an HTTP 101 Switching Protocols Respsonse from an HTTP Server Client to an HTTP Client.
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
To demonstrate that it understands the WebSocket Protocol, the server performs a standardized transformation on the Sec-WebSocket-Key from the client request and returns the results in the Sec-WebSocket-Accept header:
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
IE10 then compares Sec-WebSocket-Key with Sec-WebSocket-Accept to validate that the server is a WebSocket server and not a HTTP server with delusions of grandeur.
The client handshake established a HTTP-on-TCP connection between IE10 and server. After the server returns its 101 response, the application-layer protocol switches from HTTP to WebSockets which uses the previously established TCP connection.
HTTP is completely out of the picture at this point. Using the lightweight WebSocket wire protocol, messages can now be sent or received by either endpoint at any time.
Diagram illustrating WebSocket messages being sent between two Web sockets.

Programming Connecting to a WebSocket Server

The WebSocket protocol defines two new URI schemes which are similar to the HTTP schemes.
  • "ws:" "//" host [ ":" port ] path [ "?" query ] is modeled on the “http:” scheme. Its default port is 80. It is used for unsecure (unencrypted) connections.
  • "wss:" "//" host [ ":" port ] path [ "?" query ] is modeled on the “https:” scheme. Its default port is 443. It is used for secure connections tunneled over Transport Layer Security.
When proxies or network intermediaries are present, there is a higher probability that secure connections will be successful, as intermediaries are less inclined to attempt to transform secure traffic.
The following code snippet establishes a WebSocket connection:
var host = "ws://example.microsoft.com";
var socket = new WebSocket(host);

ReadyState – Ready … Set … Go …

The WebSocket.readyState attribute represents the state of the connection: CONNECTING, OPEN, CLOSING, or CLOSED. When the WebSocket is first created, the readyState is set to CONNECTING. When the connection is established, the readyState is set to OPEN. If the connection fails to be established, then the readyState is set to CLOSED.

Registering for Open Events

To receive notifications when the connection has been created, the application must register for open events.
socket.onopen = function (openEvent) {
document.getElementById("serverStatus").innerHTML = 'Web Socket State::' + 'OPEN';
};

Details Behind Sending and Receiving Messages

After a successful handshake, the application and the Websocket server may exchange WebSocket messages. A message is composed as a sequence of one or more message fragments or data “frames.”
Each frame includes information such as:
  • Frame length
  • Type of message (binary or text) in the first frame in the message
  • A flag (FIN) indicating whether this is the last frame in the message
Diagram illustrating the contents of WebSocket frames.
IE10 reassembles the frames into a complete message before passing it to the script.

Programming Sending and Receiving Messages

The send API allows applications to send messages to a Websocket server as UTF-8 text, ArrayBuffers, or Blobs.
For example, this snippet retrieves the text entered by the user and sends it to the server as a UTF-8 text message to be echoed back. It verifies that the Websocket is in an OPEN readyState:
function sendTextMessage() {
if (socket.readyState != WebSocket.OPEN)
return;

var e = document.getElementById("textmessage");
socket.send(e.value);
}
This snippet retrieves the image drawn by the user in a canvas and sends it to the server as a binary message:
function sendBinaryMessage() {
if (socket.readyState != WebSocket.OPEN)
return;

var sourceCanvas = document.getElementById('source');
// msToBlob returns a blob object from a canvas image or drawing
socket.send(sourceCanvas.msToBlob());
// ...
}

Registering for Message Events

To receive messages, the application must register for message events. The event handler receives a MessageEvent which contains the data in MessageEvent.data. Data can be received as text or binary messages.
When a binary message is received, the WebSocket.binaryType attribute controls whether the message data is returned as a Blob or an ArrayBuffer datatype. The attribute can be set to either “blob” or “arraybuffer.”
The examples below use the default value which is “blob.”
This snippet receives the echoed image or text from the websocket server. If the data is a Blob, then an image was returned and is drawn in the destination canvas; otherwise, a UTF-8 text message was returned and is displayed in a text field.
socket.onmessage = function (messageEvent) {
if (messageEvent.data instanceof Blob) {
var destinationCanvas = document.getElementById('destination');
var destinationContext = destinationCanvas.getContext('2d');
var image = new Image();
image.onload = function () {
destinationContext.clearRect(0, 0, destinationCanvas.width, destinationCanvas.height);
destinationContext.drawImage(image, 0, 0);
}
image.src = URL.createObjectURL(messageEvent.data);
} else {
document.getElementById("textresponse").value = messageEvent.data;
}
};

Details of Closing a WebSocket Connection

Similar to the opening handshake, there is a closing handshake. Either endpoint (the application or the server) can initiate this handshake.
A special kind of frame – a close frame – is sent to the other endpoint. The close frame may contain an optional status code and reason for the close. The protocol defines a set of appropriate values for the status code. The sender of the close frame must not send further application data after the close frame.
When the other endpoint receives the close frame, it responds with its own close frame in response. It may send pending messages prior to responding with the close frame.
Diagram illustrating the Close frame message and response.

Programming Closing a WebSocket and Registering for Close Events

The application initiates the close handshake on an open connection with the close API:
socket.close(1000, "normal close");
To receive notifications when the connection has been closed, the application must register for close events.
socket.onclose = function (closeEvent) {
document.getElementById("serverStatus").innerHTML = 'Web Socket State::' + 'CLOSED';
};
The close API accepts two optional parameters: a status code as defined by the protocol and a description. The status code must be either 1000 or in the range 3000 to 4999. When close is executed, the readyState attribute is set to CLOSING. After IE10 receives the close response from the server, the readyState attribute is set to CLOSED and a close event is fired.

Using Fiddler to See WebSockets Traffic

Fiddler is a popular HTTP debugging proxy. There is some support in the latest versions for the WebSocket protocol. You can inspect the headers exchanged in the WebSocket handshake:
Screen shot of Fiddler showing a WebSocket request.
All the WebSocket messages are also logged. In the screenshot below, you can see that “spiral” was sent to the server as a UTF-8 text message and echoed back:
Screen shot of Fiddler showing a WebSocket response.

Conclusion

If you want to learn more about WebSockets, you may watch these sessions from the Microsoft //Build/ conference from September 2011:
If you’re curious about using Microsoft technologies to create a WebSocket service, these posts are good introductions:
I encourage you to start developing with WebSockets today and share your feedback with us.
—Brian Raymor, Senior Program Manager, Windows Networking

IndexedDB Updates for IE10 and Metro style apps

The Internet Explorer team along with the broader Web community has continued to make improvements to the IndexedDB specification. IndexedDB is a W3C Working Draft that enables you to store, search, and retrieve data on the user's device, even when Internet connectivity is disabled.  IndexedDB is a feature of the Web platform shared by IE10 and Metro style apps in the Windows 8 Consumer Preview.
This blog post describes changes we made in Internet Explorer 10 Consumer preview to implement the latest version of the W3C spec.

Changes to Versioning

The most significant change involves how developers update their database schemas (i.e. object stores, indexes) from one version to the next. The working group (including Microsoft) decided to replace the IDBDatabase.setVersion API with a new IDBFactory.open API. The new open API uses an additional parameter to detect if you want to use the current database version of the or if you want to update the database schema to a newer version. The open API now returns an IDBOpenDBRequest object which lets you register for the onupgradeneeded event. In the event handler you can update your database schema by adding additional object stores and indexes.
To update your existing code, add a version parameter to your open method, replacing the call to setVersion, and register a new onupgradeneeded event handler on the IDBOpenDBRequest (see below).
Old code example – green highlights the impacted code
function openDBTest(dbName) {
var rq = window.msIndexedDB.open(dbName);
rq.onsuccess = successOpenningDB;
rq.onerror = failureHandler;
}

function successOpenningDB(evt) {
var db = evt.target.result;
var rq = db.setVersion("1");
rq.onsuccess = successHandler;
rq.onerror = failureHandler;
}

function successHandler(evt) {
//create schema
}
New code example – yellow highlights the changed code
function openDBTest(dbName) {
var rq = window.msIndexedDB.open(dbName, 1);
rq.onsuccess = useDB;
rq.onupgradeneeded = successHandler;
rq.onerror = failureHandler;
}

function successHandler(evt) {
//create schema
}

Additional Changes

In addition, we made several smaller (but still significant) changes to the platform:
  • Added the IDBCursor.advance(count) method. This method enables you to skip records in a cursor, which in turn enables pagination scenarios. The count parameter defines the number of records you want to skip before accessing data. Valid values are 1 or greater.
  • Added the IDBObjectStore.count(key) and IDBIndex.count(key) methods. These enable you to count the records that match specific criteria. If the key value is not specified, a count of all records inside the index or the object store is returned.
  • Added the IDBFactory.cmp(first, second) method. This method compares two key values to determine if one value is greater than the other or both values are equal.
  • IDBKeyRanges now work with additional methods, including IDBObjectStore.count, IDBObjectStore.delete, IDBIndex.count. This allows you to match records that span groups of key values.
  • Values being added to the database needed no longer need to satisfy all previously defined indexes. This allows you to add records to an IDBObjectStore that fall outside the limits of previously defined indexes.
  • If an exception is thrown within the context of an active transaction, the transaction is aborted. This implies that if an exception is thrown within the onsuccess event handler of any request, the active transaction will be aborted. However, handling the exception will allow the database transaction to continue as normal.
    // This won’t abort the transaction because there is no active transaction.
    function createTransaction() {
    var txn = db.transaction("test");
    window.aaaaaa();
    }

    // This will abort the transaction because the exception is thrown when there is an active transaction.
    var rq = objectStore.add(record);
    rq.onsuccess = function (event) {
    window.aaaaaa();
    }
  • Added support to index properties on a Blob. This allows you to download binary data from the Web, store it locally, and use blob properties (e.g. name, size, etc.) as indexes or unique keys into the blob. This functionality enables scenarios like offline listening of your music collection or viewing of images and videos, while having the ability to search through your collection using the blob’s name. Our latest IE Test drive demo shows you how you can use this functionality to view your Facebook albums offline.
  • Screen shot of the IE Test Drive demo Facebook Companion Screen shot of IE Test Drive demo Facebook Companion
We also submitted over 100 test cases to the W3C working group for IndexedDB, including new tests and updates to existing tests.

Controlling How Sites and Apps use IndexedDB

In addition to updates to match changes in the W3C specification, the Windows 8 Consumer Preview includes improvements that allow users to remain in control of how sites and apps use IndexedDB on their devices:
  • Introduced an uninstall handler for Metro style apps that use indexedDB. This handler ensures that any time end-users remove an application, the related data in the app’s IndexedDB database will be automatically deleted during the uninstall process.
  • Implemented a quotas (storage limits) to prevent sites from exhausting disk space. Quota limits can be updated by IT Admins via group policy settings or by users with administrative access to the Registry. However, quotas don’t apply to Metro style apps.
  • Added a new browser interface for end-users to manage their databases and manage quotas. Users can use the Caches and databases dialog to remove individual databases. Alternatively, you can remove all databases using the Delete Browsing History dialog to select the “Cookies and Web site data” checkbox.
Screen shot of the new Caches and databases tab of the Website Data Settings dialog. This allows you to control whether websites may create caches and databases and how large those caches and databases may be.Screen shot of the updated Delete Browsing History dialog showing the new wording of the Cookies option to include web site data, specifically databases created by Web sites.
Screen shots of the new Caches and databases tab of the Website Data Settings dialog and the updated Delete Browsing History dialog

Looking Ahead

The W3C WebApp Working Group continues to drive IndexedDB to completion by making important improvements and reducing the number and scope of changes made to the spec.  This is an important step for Web developers building on this technology in the near future, including in Windows 8 and IE10.
We look forward to seeing how you use IndexedDB in your sites and apps, and welcome your feedback on IndexedDB in IE10.
—Israel Hilerio, Ph.D., Principal Program Manager, Internet Explorer

суббота, 17 марта 2012 г.

Media Capture Prototype: Improved Support for Real World Web Apps

  • Today we updated on HTML5 Labs the previously released Media Capture prototype to better align it to the latest W3C editor draft.
    The HTML Media Capture working draft continues to evolve alongside related discussions in the Web RTC workgroup, and we have blogged previously about why this feature is important and how our Media Capture prototype implemented it in the past.
    Because the API surface for this feature is far from final, we are supporting a simple capture syntax with this update, which is based on the most current proposal. We expect the capture syntax to change as the requirements for media capture are clarified in the task force.

    Latest Updates

    In this update, we are specifically adding support for a version of the getUserMedia method (function names are ms-prefixed for prototyping purposes), the MediaStream interface, and its associated events and callbacks. getUserMedia allows Web developers to suggest what specific capture devices are desired. This then allows end users to authorize the browser to access the device they selected for the duration of the capture session.
    function onLoad() {
    navigator.msGetUserMedia(options, cameraStarted);
    }

    function cameraStarted(mediaStream) {
    msMediaStream = mediaStream;
    getReady();
    document.getElementById("previewWindow").style.display = "block";
    document["imgPreview"].src = URL.createObjectURL(mediaStream);
    }
    The advantage of this is two-fold: it protects user security and privacy and lets them pick the optimal device for the capture task from the many options available to them on a modern PC.
    Looking back at our earlier proposals, we believe those scenarios are still important and relevant to this update: last March we released a prototype implementation of the audio portion of a working draft of the W3C Media Capture API on HTML5 Labs. This prototype publicized some proposed API enhancements described in section 6.1 of Microsoft’s HTML Speech XG Speech API Proposal. We then updated the prototype to include the image and video capture features described in the proposal to support scenarios we’ve heard are important for Web developers, and incorporated your feedback on audio.
    This past November, we took our experience with the development of this prototype and interest in media capture for the browser to the W3C's technical plenary meeting (TPAC). Travis Leithead shared some of our feedback with the Device APIs (DAP) Working Group and we continued existing discussions within the HTML Speech Incubator Group. One result of our engagement was the formation of a media capture joint task force in order to bring the best of local media capture and real-time communication scenarios together. We are actively participating in the task force and support the getUserMedia approach to capture.
    We then released an updated prototype in December that gives Web developers early access to photo, video and audio media capture APIs in the browser. We anticipate evolving the prototype to share implementation feedback and experience with the new media capture task force. The end goal remains to create the best possible standard for the benefit of the whole Web community.
    Then, as discussed earlier, today we have updated the previously released Media Capture prototype to better align it to the latest W3C editor draft, which supports a simple capture syntax that is based on the most current proposal.
    Microsoft remains actively engaged in the Media Capture task force and continues to advocate for the creation of the highest quality API to support these scenarios.

    We Welcome Your Feedback

    As always, we look forward to hearing from you, especially your questions and comments on how we can make this feature as good as possible for both the Developer community and end users. Please contact us either in the comment section on this blog or here.
    —Adalberto Foresti, Senior Program Manager, Interoperability Strategy Team
    Travis Leithead, Program Manager, Internet Explorer
  • IEBlog

    Spring into St. Patrick’s Day with HTML5

    • 17 Comments
    Shamrock artAnother holiday brings us another opportunity to celebrate it with you. We’re pleased to mark the transition into spring as well as St. Patrick’s Day with Irish Spring, a new hardware-accelerated HTML5 experience that shows the benefits of Internet Explorer 10 on Windows 8 Consumer Preview.
    Irish Spring incorporates HTML5 canvas and CSS gradients, opacity, transforms, and animation along with HTML5 audio. With the Windows Consumer Preview and IE10’s support for multi-touch you can propel the clovers and leaves around in a strangely satisfying fashion. Try it with multiple fingers on your touch device. Alternatively, you can use your mouse to move the clovers around the screen.
    If you aren’t using Internet Explorer 10 and think your browser can still handle the heat, give it a shot. But don’t be surprised if the lack of multi-touch and full hardware acceleration leaves you wanting to install the Windows 8 Consumer Preview.

    This video shows IE10's support for multi-touch and hardware acceleration in action with Irish Spring.
    Put a little spring in your friends’ step by clicking the share controls at the top of the demo.
    From the entire IE team, we wish you a happy, safe, and lucky St. Patrick’s Day!
    —Tobin Titus, Program Manager, Internet Explorer
  • IEBlog

    Enhanced Protected Mode

    • 33 Comments
    Every release of Internet Explorer includes new security enhancements to help keep you safe as you browse the Internet. The new Enhanced Protected Mode in Internet Explorer 10 helps keep your data safe even if an attacker has exploited a vulnerability in the browser or one of its add-ons.
    There is no single thing that can keep you secure by itself, so we pursue multiple strategies, including:

    Protection from socially-engineered attacks

    There are a variety of miscreants that want to steal your personal information or take over your computer by impersonating Web sites that you trust. SmartScreen Filter provides the best protection available against malware attacks and phishing. In Windows 8, this protection was added to the Windows Shell, to help keep you safe from malware no matter how it was downloaded.

    Protection from attacks designed to exploit vulnerabilities in Web sites

    “Good” Web sites can have security vulnerabilities that can allow evil Web sites to steal your data or perform actions as if they were you. We protect you with the XSS Filter, which automatically prevents certain types of attacks, and make it easier for Web sites to secure themselves with Declarative Security features, like IE10’s new support for the HTML5 Sandbox.

    Protection against attacks designed to exploit the browser or operating system

    Automatic updating ensures that you have the latest updates installed. This protects you against security issues that have been fixed. IE9 added memory protection features to make it harder to exploit certain types of vulnerabilities and we enhanced these features in IE10. We also added a new layer of protection in IE10 called Enhanced Protected Mode.

    Enhanced Protected Mode

    Protected Mode, which was added in IE7 for Windows Vista, is defense in depth feature that helps prevent attackers from installing software or modifying system settings if they manage to run exploit code. It is an extra layer of protection that locks down parts of your system that your browser ordinarily doesn’t need to use. For example, your browser doesn’t usually need to modify system settings or write to your Documents folder. Protected Mode is based on the principle of least privilege -- by reducing the capabilities that Internet Explorer has, the capabilities available to exploit code are reduced as well.
    “Enhanced” Protected Mode takes this concept further by restricting additional capabilities. Below is a list of some of the new ways that Enhanced Protected Mode helps keep you safe:

    64-bit processes

    Most PCs shipped in the last few years have 64-bit CPUs, and many have a 64-bit version of Windows installed. “64-bit” is usually thought of as a way to extend the amount of memory that a program on your computer can use: because 64-bit processors use 64-bit memory addresses instead of 32-bit ones, a program can “address,” or use, more memory if it’s available.
    A 32-bit number is large – it’s a little more than 4 billion. A 64-bit address is much larger number – roughly 18 pentillion and change (18,446,744,073,709,551,616). Not only does a 64-bit number let you address more memory, it also makes existing memory protection features such as ASLR (Address Space Layout Randomization) much more effective. Heap spray attacks, which are used by attackers to plant malicious code at predictable locations, become much more difficult because it isn’t practical to “fill up” a 64-bit address space – you’ll run out of memory and disk space long before any sizable fraction of the address space is sprayed.

    Protecting your personal information

    When you run a program, it has access to anything on the computer that you have access to, including your personal documents. Enhanced Protected Mode restricts Internet Explorer from locations that contain your personal information until you grant permission to it. This helps prevent exploit code from accessing your personal information without your permission.
    For example, consider Web-based email. If you want to attach a file from your Documents folder to the email, then Internet Explorer needs permission to access the file and upload it to your email provider. With Enhanced Protected Mode, a “broker process” will grant Internet Explorer temporary access to the file only if you actually click on “Open” on the file upload dialog:
    Screen shot showing attaching a file from your Documents folder to an email using a Web-based email application
    Notice that there are no extra prompts. Brokering is done automatically after you choose to open a file. This is like providing a single safe deposit box to Internet Explorer when requested, instead of giving access to the entire safe all of the time.

    Protecting your corporate assets

    Most corporate networks, or “intranets,” contain valuable information that must be protected from attackers. Enhanced Protected Mode restricts an exploit’s ability to access corporate network resources in three ways. First, Internet tab processes, which is where untrusted Internet pages load, do not have access to a user’s domain credentials. Second, they cannot operate as local webservers, which makes it more difficult to impersonate an Intranet site. Third, Internet tabs cannot make connections to intranet servers.

    Default Settings and Compatibility

    Metro style Internet Explorer always runs with Enhanced Protected Mode enabled – there isn’t anything that you need to configure – just browse. Because Metro style Internet Explorer offers plug-in free browsing, the compatibility impact of this security feature is minimal.
    Many add-ons, such as Adobe Flash and certain toolbars are not yet compatible with Enhanced Protected Mode. Some Web sites still require Adobe Flash in order to work, and some users enjoy the additional functionality offered by some toolbars. In Windows 8 Beta, Enhanced Protected Mode can be enabled in the desktop under Internet Options->Advanced:
    Screen shot of the Advanced tab of the Internet Options dialog showing the new “Enable Enhanced Protected Mode” option.
    After you enable Enhanced Protected Mode, incompatible add-ons will automatically be disabled. If you encounter a site that needs an add-on such as Flash in order to work, you can disable Enhanced Protected Mode just for that particular Web site.
    Notification message which reads “This webpage wants to run 'Adobe Flash Player 10.3 d162'. If you trust this site, you can disable Enhanced Protected Mode for this site to run the control.” The notication bar contains one button labeled “Disable”.
    This allows you to continue using the site, and have Enhanced Protected Mode enabled on the rest of the Internet. Keep in mind that you should only do this if you know and trust the Web site.
    Of course, if you prefer to browse without add-ons, you can always turn on ActiveX Filtering, which will prevent you from seeing this prompt.

    Summary

    Defense-in-depth is an area of continual investment for the Windows team. It’s a widely-applied principle in the real world as well. Safety deposit boxes have locks on them. But they are also kept inside of a locked room, inside of a bank, which is locked and is armed with an advanced security system. Enhanced Protected Mode is another layer of protection that helps protect your data from malicious attackers.
    —Andy Zeigler, Senior Program Manager, Internet Explorer
  • IEBlog

    Enhanced Memory Protections in IE10

    • 19 Comments
    Internet Explorer 10 introduces significant improvements in memory protections to help make vulnerabilities harder to exploit, helping to keep users safe on the sometimes-hostile Web. These improvements will increase the difficulty and development cost of exploits, making life harder for the bad guys.
    While socially-engineered malware is the primary way that bad guys get their code onto victims’ computers, that is largely because browser vulnerabilities have become less common and harder to exploit over the last few years. However, as more and more users upgrade to IE9 and benefit from the protection provided by SmartScreen Filter, bad guys have a renewed interest in attacking the browser and its add-ons directly.
    In today’s post, I explain the threat environment, survey the existing protections available in IE9, and explain how IE10’s new memory protections provide even more security.

    Attacking Web Browsers

    The goal of an attacker exploiting a memory-related vulnerability is to cause the browser’s path of code execution to deviate into code of the bad guy’s choosing. To achieve this, the attacker needs two things to be successful. They need to have code available on the victims’ machine that they wish to run. The techniques used to obtain such code can be grouped into two classes. An attacker can place their own malicious code into memory using techniques like heap spraying. Or an attacker can select code to execute that is already present in memory using a technique called Return Oriented Programming.
    The attacker also needs to be able to exploit a vulnerability that allows the flow of code execution to be altered from design, such as a buffer overflow vulnerability. Then they can change the code path to “jump to” the address of the code they want executed.
    In a typical buffer overflow attack, a carefully crafted data set is placed on the thread’s stack, overflowing its assigned buffer and overwriting other data structures. Attackers attempt to overwrite structures like exception handler records, or the return address of the function, which would allow them to change the flow of code to a location in memory of their choosing.
    Diagram illustrating that when the amount of data written to a local buffer exceeds its allocation, critical portions of the stack can be overwritten and could cause a crash. By submitting carefully crafted data, an attacker can overwrite the return address, changing the flow of code execution to an arbitrary memory location.
    Other types of attacks include use-after-free vulnerabilities, in which the application is tricked into accessing a released object whose memory has been reused for some other purpose.

    Defending the Browser

    Memory protection technologies provide a front line of defense to block attackers from achieving their goals. These technologies exist to make exploiting vulnerabilities more difficult, less reliable, and in some cases impossible. Memory protections aim to safely terminate a browser process under attack before a vulnerability can be successfully exploited to run the attacker’s code. In many cases, protections allow vendors time to produce and distribute a fix before a vulnerability can be exploited to cause damage.
    The Memory Mitigation Technologies employed by Internet Explorer have evolved over time to help defend against new attack techniques as they are developed and popularized. Many defenses, like the /GS compiler flag, have been used by previous versions of Internet Explorer but are updated and enhanced over time. Some defenses, like ForceASLR (described shortly) are new to IE10 and rely on new operating system features.

    Compile time mitigations

    Compiler mitigations are available to software developers and should be applied as part of a development best practice. The Internet Explorer team includes these mitigations during the development Internet Explorer as a requirement of our Security Development Lifecycle. We encourage software developers to adopt their own SDL process that include implementation of these compile time mitigations.
    The /GS flag was first introduced in Visual Studio .NET 2002 and has been used by all supported IE versions. It is a compiler technology which adds a Buffer Overrun Detection capability to an application’s stack. Security secrets known as “canaries” are added to application’s stack boundaries at runtime. For example, a canary placed between a stack buffer and a return address, will be overwritten by a buffer overflow attack targeting the return address. This provides a means for the process to detect that an overflow has occurred. An exception will be raised and the process can be safely terminated before the attacker’s code is run.
    Diagram showing how a security secret is placed between local variables and the return address. Before the function returns, teh value of the secret is compared with the original. If the comparison fails, an exception is raised and the process can be safely terminated.
    This basic protection concept has been improved in each new version of Visual Studio. The latest version of Enhanced /GS, used by Internet Explorer 9+, includes greatly improved heuristics to protect more functions, including Non-Pointer arrays and pure data structures. In addition, improved optimization has eliminated unnecessary checks, decreasing the performance cost of the defense.
    The /SAFESEH flag is a linker option that provides a mechanism for an application’s registered exception handlers to be stored in a lookup table in a secure memory location. In the event of an exception, the exception handler addresses on the application’s stack are validated against the lookup table. If the values do not match, the process will be terminated.
    Diagram showing that exception registration addresses are compared with the values stored in lookup. If the values don't match, an exception is raised and the process is terminated.
    One problem with the /SAFESEH flag is that it requires all DLL modules to opt-in to the protection to reliably protect the process. If any module does not opt-in, protection is less effective. While the SDL requires that all of Microsoft’s code be compiled with SAFESEH, third-party add-ons might not be compiled with the flag.
    The /DYNAMICBASE flag is a linker option that opts an application into an operating system mitigation known as Address Space Layout Randomization (ASLR), discussed in more detail later in this post.
    Similarly to the /SAFESEH limitation, a problem with the /DYNAMICBASE flag is that any DLL module that doesn’t opt-in to this protection reduces the value of ASLR as an exploit mitigation. Any module at a predictable location can be targeted by an attacker, and an exploit may only require one such predictable target. Many recent exploits target browser add-ons that don’t opt-in to the protection of ASLR. For instance, an Adobe Reader and Acrobat 0-day exploit in 2010 relied on the predictable location of functions within a module named icucnv36.dll that failed to opt-in to ASLR.

    Run time mitigations

    Runtime mitigations allow the operating system to help participate in keeping the process secure.
    DEP/NX is an operating system mitigation that relies upon key security features (Data Execution Prevention or No eXecute) of modern CPUs. This mitigation enables memory pages to be marked as non-executable (Data); the processor will refuse to run code on a memory page so marked.
    In the second stage of a memory exploit, an attacker may try to execute their own code which they have added to a data page in memory. In scenarios where the data page has been marked as non-executable, the attacker’s code will fail to run and the process will be safely terminated.
    DEP/NX support was first enabled by default in IE8, and remains enabled in IE10.
    SEHOP is a runtime mitigation that provides an exception-handler tamper-protection mechanism much like the /SAFESEH compiler flag. This protection works by inserting a symbolic exception record as the tail record in the thread’s exception handler list. In the event of an exception, the exception handler list is walked to ensure that the symbolic record can be reached. If it cannot be reached, this indicates that the exception handler chain is corrupted and the process will be safely terminated. Unlike SafeSEH, SEHOP does not require each individual module to opt-in, and thus it provides protection even if add-ons were not compiled with the most secure flags.
    SEHOP was first enabled in IE9 and remains enabled in IE10.
    Address Space Layout Randomization was first introduced in Windows Vista and has been greatly improved in Windows 8. ASLR assigns applications a random base memory address when they are initially loaded into memory. In addition, other memory structures such as the Process Environment Blocks (PEB), Thread Environment Blocks (TEB), Stacks and Heaps are also assigned to random locations in memory.
    Randomizing the location of objects and functions in memory helps prevent an attacker from discovering where they are, which helps prevent a technique called Return Oriented Programming. This randomization can be thought of as securing the attacker’s payload with a combination lock. If an attacker doesn’t have the combination, they only get one guess. Guessing wrong means the attack will fail and the process will safely be terminated.
    The following illustration depicts how core system components are loaded in random memory addresses on system startup.
    Diagram showing how the physical memory location of various system DLLs changes between a first and second boot.
    ASLR in Windows 8 has seen a number of improvements, all of which are utilized by Internet Explorer 10.
    All Bottom-Up and Top-Down allocations are now randomized using 8 bits of entropy. This improvement significantly reduces predictable memory regions including VirtualAlloc and MapViewOfFile.
    High Entropy Address Space Layout Randomization (HEASLR) takes advantage of the increase in 64bit address space and assigns more bits to entropy. This has the effect of drastically increasing the number of potential addresses that may be assigned to a 64bit process. All 64bit processes can opt-in to the increased entropy made available by HEASLR. Processes can opt-in either at link time (/HIGHENTROPYVA) or at load time via a new Image File Execution Option.
    By default, the Metro style browser runs in 64bit mode on 64bit computers, providing a much larger address space and thus more random memory layout.
    ForceASLR is arguably the most important change to ASLR in Windows 8. ForceASLR is a new loader option used by Internet Explorer 10 to instruct the operating system to randomize the location of all modules loaded by the browser, even if a given module was not compiled with the /DYNAMICBASE flag. The ForceASLR protection was added to the Windows 8 kernel, and the feature is now available as an update to Windows 7 that will be installed when Internet Explorer 10 is installed on that platform.
    To help ensure compatibility with this feature, and to provide memory-randomization protection to older Internet Explorer versions that don’t support ForceASLR, we continue to recommend that add-on developers make use of the /DYNAMICBASE flag.

    Summary

    I hope this brief overview of the memory protections present in Windows 8 and Internet Explorer 10 has proven valuable. Under the covers, we’ve made many other tweaks for enhanced security, but many of them are so esoteric that we don’t even have names for them. We do have a few more security-related announcements coming, so stay tuned for updates as we continue our mission to deliver a secure Web browsing platform.
    —Forbes Higman, Security Program Manager, Internet Explorer
  • IEBlog

    Web Platform Features in Windows Consumer Preview

    • 53 Comments
    Internet Explorer 10 in the Windows Consumer Preview introduces a number of new or updated Web platform features when compared to the IE10 in the Windows Developer Preview released September 13, 2011. Some of these shipped in the fourth IE10 platform preview released November 29, 2011, and have been blogged about since; some are new in the Consumer Preview.

    New or Updated Web Platform Features

    The following Web platform capabilities in the Consumer Preview were not in the Developer Preview:
    • Cross-Origin Resource Sharing (CORS) for XMLHttpRequest (spec / post / dev guide)
    • CSS -ms-user-select property (post / dev guide)
    • CSS3 font-feature-settings property to access advanced OpenType® features (spec / post / dev guide)
    • Document setting to enable floating point values in CSS-OM (post / dev guide)
    • HTML5 BlobBuilder API and new APIs to save or open files (spec / post / dev guide)
    • HTML5 track element for HTML5 video captions (spec / post / dev guide)
    • Interoperable HTML5 Quirks mode (post / dev guide)
    • JavaScript Typed Arrays (post)
    • Meta tag to alert user that site requires ActiveX add-ons available only in desktop IE10 (post)
    • Removal of legacy graphics features from IE10 standards mode (post)
    • Changes to support latest HTML5 WebSocket API (spec)
    • Web Worker thread pooling
    Across the board, we’ve improved performance and addressed feedback on the platform features that were available in the Windows Developer Preview but not IE9:

    More to Come: User Interface Improvements

    Metro style Internet Explorer in the Windows Consumer Preview contains many user interface changes and additions compared to the Windows Developer Preview. You can get a taste for these in what Gizmodo wrote about Internet Explorer 10. We will be blogging about these new features in the coming days both here and on Building Windows 8.
    —Ted Johnson for IEBlog
  • IEBlog

    Windows Consumer Preview: The Fifth IE10 Platform Preview

    • 85 Comments
    With IE10 in Windows 8, we reimagined the browser. We designed and built IE10 to be the best way to experience the Web on Windows. Consumers can now enjoy more touch-friendly and beautiful, fast and fluid Web applications with the updated IE10 engine included in the Windows Consumer Preview. This fifth Platform Preview of IE10 delivers improved performance and support for more HTML5:

    This video shows some of the touch-friendly HTML5 technologies in the fifth IE10 Platform Preview, included with the Windows Consumer Preview.
    View this video on YouTube
    You can read more about the improvements to the Metro style browsing experience on the Building Windows 8 blog. The remainder of this post discusses the underlying HTML5 engine.
    Windows 8 includes one HTML5 browsing engine that powers both browsing experiences (the Metro style one and desktop one) as well as Metro style applications that use HTML5 and JavaScript. The common HTML5 engine provides consistently fast, safe, and powerful support for Web standards and the Web programming model, for both browser experiences as well as for Metro style applications.
    Consumers experience this power with rich, beautiful visual effects that take full advantage of the underlying hardware safely. Some examples that you can try at the IE Test Drive site with the Consumer Preview include fast and fluid multi-touch support in Web pages and the latest database APIs, which enable you to take photos from a Web site offline. The Test Drive site demonstrates how much better the Web can be with rich visual effects, sophisticated page layouts, and the advances to the Web programming model. You can read the full list in the IE10 developer guide.

    A Better Web Ahead

    Working closely with the developer community, we see a much better Web ahead.
    IE10 in the Metro style experience is plug-in free. Almost all phones and devices are already plug-in free and many sites already run plug-in free for them. To deliver the richest experience, and one experience that scales across different devices, we continue to recommend that developers detect when plug-ins are not available and rely on native browser patterns.
    Similarly, we recommend that developers update their sites’ older, out of date libraries (like this one) that don’t work well with new browsers like IE10.
    We also recommend that developers use feature, not browser, detection. Often, the compatibility problem reports we receive have more to do with sites detecting IE and sending it different content than they send other browsers than any particular issue in IE. You can see some examples of how IE makes up for certain sites by adjusting the information it sends to particular sites (e.g. sending an iPad identification token) based on the Compatibility View (CV) list in the post script to this blog entry.
    Developers can find sample feature detection code patterns in several IE blog posts, including this one.
    The quality and correctness of different browsers’ HTML5 engines continue to vary widely. We continue to contribute to the test suites under development at the HTML5 standards bodies to further the goal of interoperability and same markup. We’ve submitted 456 new tests to them that you can view at the IE Test Center as well. As different browsers improve their support of the same markup to produce the same results, we can all realize the promise of HTML5.
    You can find a full list of new functionality available to developers in the IE10 developer guide here. Download the Windows 8 Consumer preview to try this update to IE10. We look forward to continued engagement with the developer community and your feedback on Connect.
    ―Dean Hachamovitch, Corporate Vice President, Internet Explorer
  • IEBlog

    Protecting Consumers’ Privacy Online

    • 23 Comments
    This morning in the United States, the White House announced a new “Consumer Privacy Bill of Rights” as part of the effort to improve consumers’ online privacy. As I’ve mentioned before, Microsoft is actively participating in the industry initiative for Tracking Protection at the W3C to produce Web standards for online privacy.
    The Tracking Protection Working Group is chartered to work on two complementary initiatives: Tracking Preference Expression (Do Not Track) and Tracking Selection Lists (TSL). The TSL editor’s draft defines a format for interchangeable lists for blocking or allowing tracking elements from Web pages. Last month, at the W3C face-to-face meeting, the working group decided that a sub-group (or “task force”) of those interested in TSLs should work on the specification together.
    Work on Do Not Track (DNT) is continuing and the W3C expects this to become a standard sometime in 2012. In the meantime, IE’s Tracking Protection feature is available to IE9 and IE10 users today. This is the only technology that can filter out unwanted cookies, beacons, and other tracking devices without requiring Web sites, advertisers, and publishers to change.
    At the CPDP 2012 conference in Brussels, Simon Davies and Alexander Hanff of Privacy International launched two new tracking protection lists designed to protect consumers from Web Analytics and Behavioural Tracking. These lists are available from http://www.privacyonline.org.uk/. Check out the complete set of Tracking Protection Lists available from the IE Gallery (including the popular EasyPrivacy and Fanboy lists).
    --Adrian Bateman, Program Manager, Internet Explorer

    Note: Correction in last paragraph
  • IEBlog

    Google Bypassing User Privacy Settings

    • 156 Comments
    When the IE team heard that Google had bypassed user privacy settings on Safari, we asked ourselves a simple question: is Google circumventing the privacy preferences of Internet Explorer users too? We’ve discovered the answer is yes: Google is employing similar methods to get around the default privacy protections in IE and track IE users with cookies. Below we spell out in more detail what we’ve discovered, as well as recommendations to IE users on how to protect their privacy from Google with the use of IE9's Tracking Protection feature. We’ve also contacted Google and asked them to commit to honoring P3P privacy settings for users of all browsers.
    We’ve found that Google bypasses the P3P Privacy Protection feature in IE. The result is similar to the recent reports of Google’s circumvention of privacy protections in Apple’s Safari Web browser, even though the actual bypass mechanism Google uses is different.
    Internet Explorer 9 has an additional privacy feature called Tracking Protection which is not susceptible to this type of bypass. Microsoft recommends that customers who want to protect themselves from Google’s bypass of P3P Privacy Protection use Internet Explorer 9 and click here to add a Tracking Protection List. Customers can find additional lists and information on this page.

    Background: Google Bypassing Apple’s Privacy Settings

    A recent front page Wall Street Journal article described how Google “bypassed Apple browser settings for guarding privacy.” The editor and CEO of Business Insider, a business news and analysis site, summarized the situation:
    Google secretly developed a way to circumvent default privacy settings established by a… competitor, Apple… [and] Google then used the workaround to drop ad-tracking cookies on the Safari users, which is exactly the sort of practice that Apple was trying to prevent.
    Third-party cookies are a common mechanism used to track what people do online.  Safari protects its users from being tracked this way by a default user setting that blocks third-party cookies.  Here’s Business Insider’s summary:
    What Safari does NOT allow, by default, is for third-party … cookies on users' computers without their permission. It is these ad-tracking cookies that cause lots of Internet users to freak out that their privacy is being violated, so it's understandable that Apple decided to block them by default.
    But these default settings have created a problem for Google, at least with respect to its goals for its advertising business.
    Google’s approach to third-party cookies seems to have the side effect of Safari believing they are first-party cookies.

    What Happens in IE

    By default, IE blocks third-party cookies unless the site presents a P3P Compact Policy Statement indicating how the site will use the cookie and that the site’s use does not include tracking the user. Google’s P3P policy causes Internet Explorer to accept Google’s cookies even though the policy does not state Google’s intent.
    P3P, an official recommendation of the W3C Web standards body, is a Web technology that all browsers and sites can support. Sites use P3P to describe how they intend to use cookies and user information. By supporting P3P, browsers can block or allow cookies to honor user privacy preferences with respect to the site’s stated intentions.
    It’s worth noting that users cannot easily access P3P policies. Web sites send these policies directly to Web browsers using HTTP headers. The only people who see P3P descriptions are technically skilled and use special tools, like the Cookie inspector in the Fiddler tool. For example, here is the P3P Compact Policy (CP) statement from Microsoft.com:
    P3P: CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI"
    Each token (e.g. ALL, IND) has a specific meaning for a P3P-compliant Web browser. For example, ‘SAMo’ indicates that ‘We [the site] share information with Legal entities following our practices,’ and ‘TAI’ indicates ‘Information may be used to tailor or modify content or design of the site where the information is used only for a single visit to the site and not used for any kind of future customization.’ The details of privacy are complex, and the P3P standard is complex as well. You can read more about P3P here.
    Technically, Google utilizes a nuance in the P3P specification that has the effect of bypassing user preferences about cookies. The P3P specification (in an attempt to leave room for future advances in privacy policies) states that browsers should ignore any undefined policies they encounter. Google sends a P3P policy that fails to inform the browser about Google’s use of cookies and user information. Google’s P3P policy is actually a statement that it is not a P3P policy. It’s intended for humans to read even though P3P policies are designed for browsers to “read”:
    P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
    P3P-compliant browsers interpret Google’s policy as indicating that the cookie will not be used for any tracking purpose or any purpose at all. By sending this text, Google bypasses the cookie protection and enables its third-party cookies to be allowed rather than blocked. The P3P specification (“4.2 Compact Policy Vocabulary”) calls for IE’s implemented behavior when handling unknown tokens: “If an unrecognized token appears in a compact policy, the compact policy has the same semantics as if that token was not present.”
    Similarly, it’s worth noting section “3.2 Policies” from the P3P specification:

    3.2 Policies

    In cases where the P3P vocabulary is not precise enough to describe a Web site's practices, sites should use the vocabulary terms that most closely match their practices and provide further explanation in the CONSEQUENCE field and/or their human-readable policy. However, policies MUST NOT make false or misleading statements.
    P3P is designed to support sites that convey their privacy intentions. Google’s use of P3P does not convey those intentions in a manner consistent with the technology.
    Because of the issues noted above, and the ongoing development of new mechanisms to track users that do not involve cookies, our focus is on the new Tracking Protection technology.

    Next Steps

    After investigating what Google sends to IE, we confirmed what we describe above. We have made a Tracking Protection List available that IE9 users can add by clicking here as a protection in the event that Google continues this practice. Customers can find additional lists and information on this page.
    The premise of Tracking Protection in IE9 is that tracking servers never have the opportunity to use cookies or any other mechanism to track the user if the user never sends anything to a tracking server. This logic underlies why Tracking Protection blocks network requests entirely. This new technology approach is currently undergoing the standardization process at the W3C.
    This blog post has additional information about IE’s cookie controls, and shows how you can block all cookies from a given site (e.g. *.google.com) regardless of whether they are first- or third-party. This method of blocking cookies would not be subject to the methods Google used. We recommend that users not yet running IE9 take steps described in this post.
    Given this real-world behavior, we are investigating what additional changes to make to our products. The P3P specification says that browsers should ignore unknown tokens. Privacy advocates involved in the original specification have recently suggested that IE ignore the specification and block cookies with unrecognized tokens. We are actively investigating that course of action.
    ―Dean Hachamovitch, Corporate Vice President, Internet Explorer
  • IEBlog

    Sub-pixel Rendering and the CSS Object Model

    • 9 Comments
    With Windows 8, you have an unprecedented choice of devices for browsing the Web, from large desktop screens to small slates. In order to accommodate this range of devices, the browser must be able to scale and layout the Web at many different screen sizes and dimensions. We've previously blogged about some of the features in IE that support these scenarios. Sub-pixel positioning (of text and layout) is one of the core platform technologies which enable Web pages to look beautiful and consistent at any scale.
    In this post, we describe changes made in IE10 to better support sub-pixel positioning through the CSS-OM.
    Web developers can build beautiful layouts through a variety of platform technologies. Generally, developers use CSS style sheets to describe the layout a Web site. In some scenarios, Web developers also depend on JavaScript code to measure, align, or position elements of a Web page with pixel-perfect precision. For example, some online editors carefully position an edit box exactly over the top of existing content so that it only appears as if you are directly editing the existing content. Scenarios such as this one may use the CSS object model (CSS-OM) APIs to read and/or set element position. The CSS-OM is a set of JavaScript APIs for programmatically manipulating CSS.
    Measuring and aligning layout elements using the CSS-OM APIs can be problematic because of the way that those APIs round or truncate sub-pixel positioned values to whole-pixel numbers.

    A Quick Note about Pixel-perfect Layouts

    In general, pixel-perfect layouts on the Web tend to conflict with the goals of enabling accessible, compatible, and adaptable content, and consequently are not a best practice. The following collage illustrates some of the bugs that can occur when the Web designer attempts to create a pixel-perfect design but unexpected Web platform differences cause their designs to go awry.
    Examples of pixel-perfect designs gone wrong
    Examples of pixel-perfect designs gone wrong
    When using the CSS-OM to dynamically generate a layout, Web developers should allow for a few pixels of potential error. Better yet, IE10 provides several new layout options that developers can use to better achieve many of these desired layouts without requiring pixel-perfect alignment using the CSS-OM.

    An Illustration

    To illustrate how the CSS-OM APIs may cause subtle positioning problems, consider a simple example. Sub-pixel positioning allows four boxes to be evenly distributed inside of the container, despite the container's size not being evenly divisible by four.
    Consider the following HTML markup fragment:
    <footer>
    <div>content 1div><div>content 2div><div>content 3div><div>content 4div>
    footer>
    with this partial CSS markup:
    footer { width: 554px; border: 1px solid black; text-align: center; }
    footer div { display: inline-block; width: 25%; }
    footer div:nth-child(even) { background-color: Red; }
    footer div:nth-child(odd) { background-color: Orange; }
    Now, let’s add a function that runs on load and reports the widths of these items:
    onload = function () {
    var footerBoxes = document.querySelectorAll("footer div");
    var s = "";
    var totalSize = 0;
    for (var i = 0; i < footerBoxes.length; i++) {
    // Reporting
    var offsetWidth = footerBoxes[i].offsetWidth;
    s += "content " + (i + 1) + " offsetWidth = " + offsetWidth + "px" + "
    "
    ;
    totalSize += offsetWidth;
    }
    s += "Total calculated offsetWidth = " + totalSize + "px" + "
    "
    ;
    s += "Container width = " + document.querySelector("footer").clientWidth + "px" + "
    "
    ;
    document.querySelector("#message").innerHTML = s;
    }
    The result of running this markup and code in IE9 is something like this:
    content 1content 2content 3content 4 content 1 offsetWidth = 139
    content 2 offsetWidth = 139
    content 3 offsetWidth = 139
    content 4 offsetWidth = 139
    Total calculated offsetWidth = 556
    Actual container width = 554

    Note that summing the values returned by the CSS-OM API offsetWidth results in the total calculated offsetWidth differing from the actual container width by two pixels, due to rounding that occurs in the offsetWidth of the individual div elements.
    The results in other browsers show a similar discrepancy, though sometimes the total is less than the actual and sometimes greater.
    When the rounding/truncation leads to a sum total that overflows the container size (as illustrated), content will start to wrap or cause unwanted scroll-bars to appear. Additionally, many containers are sized according to the text and the font used to render the text, and those font metrics may be different across browsers or alternate fonts may be selected if the requested font isn't available.
    The offsetWidth API, along with many other widely used CSS-OM properties (most dating back to IE4 in 1997), provide a convenient and fast way to extract integer pixel values for an element from a variety of different coordinate systems. All major browsers implement most of these APIs for compatibility and they are also part of the CSS-OM View module, a W3C draft standard.
    New browser features continue to demonstrate the shortfall of limiting CSS-OM properties to whole-value pixels. For example, features like SVG and CSS 2D/ 3D Transforms allow an element's dimensions to easily fall between pixels.

    Addressing the Problem

    Recognizing this limitation (in part), the W3C CSS-OM View spec describes the coordinates returned via the getBoundingClientRect() API to be floats; in other words, in values that can represent sub-pixel precision. (getBoundingClientRect() is another CSS-OM API that provides an element's bounding-box position and dimension using the same origin as the offsetWidth API.)
    In IE10 we've updated the getBoundingClientRect() API to return sub-pixel resolution by default in IE10 standards mode in order to be interoperable with other browsers and align with the W3C standard.
    Updating our example above to report the width component of the rectangle returned by getBoundingClientRect(), IE10 now reports these fractional values:
    content 1content 2content 3content 4 content 1 offsetWidth = 139, getBoundingClientRect().width = 138.5
    content 2 offsetWidth = 139, getBoundingClientRect().width = 138.5
    content 3 offsetWidth = 139, getBoundingClientRect().width = 138.5
    content 4 offsetWidth = 139, getBoundingClientRect().width = 138.5
    Total calculated offsetWidth = 556
    Total calculated getBoundingClientRect().width = 554
    Actual container width = 554

    Taking Sub-pixel Values Everywhere

    In addition to getBoundingClientRect, we also report sub-pixel position for mouse/pointer events in IE10 standards mode by default. It's only possible for the mouse/pointer to land between pixels when the zoom factor is set to a value other than 100%. Specifically, the affected mouse/pointer APIs are:
    • MouseEvent.offsetX/Y
    • MouseEvent.layerX/Y
    • MouseEvent.clientX/Y
    • MouseEvent.pageX/Y
    • MouseEvent.x/y
    To continue our commitment to compatibility with legacy Web pages (pages which may not be prepared to handle sub-pixel values from the CSS-OM in general), IE10 continues to reports whole-value pixel units by default for the other CSS-OM properties. These APIs are:
    • Element.clientHeight
    • Element.clientWidth
    • Element.clientLeft
    • Element.clientTop
    • Element.scrollTop
    • Element.scrollLeft
    • Element.scrollWidth
    • Element.scrollHeight
    • HTMLElement.offsetWidth
    • HTMLElement.offsetHeight
    • HTMLElement.offsetTop
    • HTMLElement.offsetLeft
    • TextRange.offsetLeft
    • TextRange.offsetTop
    However, if necessary, IE10 now allows Web developers to enable sub-pixel positioned values from the above-listed CSS-OM properties as well. Use of this special feature requires that the site run in IE10 Standards mode and opt-in by setting the following property on the document object:
    document.msCSSOMElementFloatMetrics = true;
    When enabled by setting document.msCSSOMElementFloatMetrics to true, all CSS-OM APIs in the previous list will begin reporting their values in sub-pixel precision that will reflect exactly the calculations used internally by the layout and rendering engine. Note that JavaScript will convert 1.00 into 1 so you may not always see a decimal point in returned values.
    Going back to our example and setting document.msCSSOMElementFloatMetrics to true results in this in IE10:
    content 1content 2content 3content 4 content 1 offsetWidth = 138.5, getBoundingClientRect().width = 138.5
    content 2 offsetWidth = 138.5, getBoundingClientRect().width = 138.5
    content 3 offsetWidth = 138.5, getBoundingClientRect().width = 138.5
    content 4 offsetWidth = 138.5, getBoundingClientRect().width = 138.5
    Total calculated offsetWidth = 554
    Total calculated getBoundingClientRect().width = 554
    Actual container width = 554

    Note the fractional values returned by offsetWidth and that all totals now match.

    Summary

    It is sometimes helpful (and, in rare cases, necessary) to be able to use the CSS-OM properties for pixel-perfect layout calculation. When using the CSS-OM, be aware of the whole-pixel-reporting characteristics of those APIs. When designing layouts either with CSS or the CSS-OM APIs, be sure to accommodate a few pixels of tolerance in order to ensure a more robust site across multiple browsers and/or devices.
    —Travis Leithead, Program Manager, Internet Explorer
    Editor's note: Updated to correct a few typographic errors.