четверг, 26 июля 2012 г.

IE10 User Agent String Update

The IE10 user agent string was originally introduced in the first platform preview of IE10. In Windows 8 Release Preview we made two additions to aid server-side feature detection.
The first addition enables detecting whether a machine has touch-capable hardware via a new Touch token. Using this token you can present a touch-friendly version of your site to users with touch-capable hardware (typically, in the case where your normal site is not touch-friendly). Keep in mind that users with touch-capable hardware may also use a mouse and keyboard. You can see where this token fits into the user agent string in the examples below.
  • IE10 on a machine without touch-capable hardware:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
  • IE10 on a machine with touch-capable hardware:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)
If you're detecting touch support client-side, do not sniff the user agent string; use navigator.msMaxTouchPoints instead. If the property exists and returns a value greater than zero, the user’s PC has touch capability. For example:
var hasTouch = navigator.msMaxTouchPoints > 0;
The second addition to the IE10 user agent string is a new architecture token for ARM devices running Windows RT. This complements the existing values for other architectures. The examples below show how this compares to a few other configurations.
  • 32-bit IE10 on 32-bit Windows:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
  • 32-bit IE10 on 64-bit Windows:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
  • 64-bit IE10 on 64-bit Windows:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)
  • IE10 on Windows RT:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0)
These additions apply to both desktop and Metro style IE10 since they expose the same platform capabilities. We recommend optimizing your site’s experience around the capabilities of the system (like Touch) through feature detection, rather than browser or environment detection. Where content depends on plug-ins, use the requiresActiveX prompt to help users switch to desktop IE10 until the content can be made plug-in free.
—Tony Ross, Program Manager, Internet Explorer

XMLHttpRequest responseXML in IE10 Release Preview

IE10 in Windows 8 Release Preview updates the responseXML from an XMLHttpRequest to return a native XML document by default. This change applies to IE10’s Standards and Quirks document modes, making them interoperable with other modern browsers and consistent with a “same markup” approach. Compatibility document modes 5, 7, 8, and 9 are unchanged.
This change may impact sites that were expecting responseXML to contain an MSXML document and depended on MSXML-specific functionality such as selectNodes. In these cases, you may request that IE10 return an MSXML by setting the responseType member of your XMLHttpRequest object to 'msxml-document'. If your code does not depend on MSXML-specific functionality, IE10’s native XML document should work for you.
Native XML support in IE9 brought DOM parity to XML and HTML and enabled XML fragments to be inserted and rendered directly within a page (even in HTML). IE9 also simplified converting between XML and DOM with the addition of DOMParser and XMLSerializer. IE10 completes this transition by updating responseXML to return a native XML document.
Like IE9, IE10 previews before the Windows 8 Release Preview returned an MSXML document for responseXML. As a result, retrieving a native document required the additional step of passing responseText to DOMParser.
var xhr = new XMLHttpRequest();
//...
var parser = new DOMParser();
var doc = parser.parseFromString(xhr.responseText, 'text/xml');
// 'doc' contains a native document in both IE9 and IE10
In the Windows 8 Release Preview, IE10 eliminates the need for an additional DOMParser step by returning a native document directly via responseXML. Existing code using DOMParser will continue to work in IE10.
var xhr = new XMLHttpRequest();
//...
var doc = xhr.responseXML;
// 'doc' contains a native document in IE10’s Standards and Quirks document modes
// it contains an MSHTML document in IE9 and in IE10’s compatibility document modes
This simplification also applies to the new response property when responseType is set to 'document'.
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.responseType = 'document';
//...
var doc = xhr.response;
// 'doc' contains a native document in IE10’s Standards and Quirks document modes
IE10 additionally includes a mechanism to opt-in to retrieving an MSXML document. This can be useful if you still need some MSXML-specific functionality (such as selectNodes) or simply need some extra time to migrate. To do this, set the responseType of your XMLHttpRequest object to 'msxml-document'.
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
try { xhr.responseType = 'msxml-document'; } catch(e){}
//...
var doc = xhr.responseXML;
// 'doc' now contains an MSXML document in IE10’s Standards and Quirks document modes
In theory the assignment should be ignored by other browsers, but in practice some do throw an exception. You can defend against this using a try/catch statement, as in the above example.
—Tony Ross, Program Manager, Internet Explorer

New Blob Constructor in IE10

IE10 in Windows 8 Release Preview adds support for a Blob constructor. We earlier wrote about and demonstrated IE10’s support for a BlobBuilder interface, an in-progress interface in the File API: Writer W3C Working Draft. This interface enables developers to work with files on the client PC. Recently, the W3C working group deprecated the BlobBuilder interface in favor of a new Blob constructor. This post explains the differences between the two.

Comparing Blob Constructor and BlobBuilder Interface

Both the Blob constructor and the BlobBuilder interface enable Web developers to create files on the client. The difference is in the syntax. Whereas BlobBuilder requires each portion of the blob to be appended during a separate call to the append method, the Blob constructor can take an array of arguments. Here’s how to create a simple text file using both BlobBuilder and the Blob constructor:
// using the Blob constructor
var textBlob1 = new Blob(["Hello", " world!"], { type: "text/plain", endings: "transparent" });

// using the MSBlobBuilder interface
var bb = new MSBlobBuilder();
bb.append("Hello");
bb.append(" world!");
var textBlob2 = bb.getBlob("text/plain");
The Blob constructor takes two arguments, the array of content to put into the blob and an optional dictionary object which can include two members, type and endings. The array of content for the blob may contain blob objects, text strings or array buffers.
Recent versions of Firefox and Chrome also support the Blob constructor. IE10 still supports the prefixed MSBlobBuilder interface in addition to the new Blob constructor. At this time, Firefox and Chrome also support their vendor-prefixed BlobBuilder interface.

Feature Detecting the Blob Constructor

As with all new features, we recommend using feature detection to determine if the Blob constructor is available in the browser your code is running on. You can use something like this:
if (typeof Blob !== "undefined") {
// use the Blob constructor
} else if (window.MSBlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder) {
// use the supported vendor-prefixed BlobBuilder
} else {
// neither Blob constructor nor BlobBuilder is supported
}
If you run the BlobBuilder Test Drive demo with the F12 developer tools console window open, it will log whether the blobs are being built via the Blob constructor or via BlobBuilder.
The addition of the Blob constructor to IE10 enables you to write standards-compliant code that works across browsers.
—Sharon Newman, Program Manager, Internet Explorer

воскресенье, 22 июля 2012 г.

IE 9.0.8 Available via Windows Update

The July 2012 Cumulative Security Update for Internet Explorer is now available via Windows Update. This security update resolves two privately reported vulnerabilities in Internet Explorer. The vulnerabilities could allow remote code execution if a user views a specially crafted Web page using Internet Explorer. An attacker who successfully exploited any of these vulnerabilities could gain the same user rights as the current user. Users whose accounts are configured to have fewer user rights on the system could be less impacted than users who operate with administrative user rights. This security update is rated Critical for Internet Explorer 9 on Windows clients and Moderate for Internet Explorer 9 on Windows servers. For more information, see the full bulletin.
Most customers have enabled automatic updating and do not need to take any action. We recommend that customers, who have not enabled automatic updating, enable it (Start Menu, type “Windows Update”). We recommend that administrators, enterprise installations, and end users who want to install this security update manually, apply the update immediately using update management software or by checking for updates using the Microsoft Update service.
—Tyson Storey, Program Manager, Internet Explorer

IE10 User Agent String Update

The IE10 user agent string was originally introduced in the first platform preview of IE10. In Windows 8 Release Preview we made two additions to aid server-side feature detection.
The first addition enables detecting whether a machine has touch-capable hardware via a new Touch token. Using this token you can present a touch-friendly version of your site to users with touch-capable hardware (typically, in the case where your normal site is not touch-friendly). Keep in mind that users with touch-capable hardware may also use a mouse and keyboard. You can see where this token fits into the user agent string in the examples below.
  • IE10 on a machine without touch-capable hardware:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
  • IE10 on a machine with touch-capable hardware:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0; Touch)
If you're detecting touch support client-side, do not sniff the user agent string; use navigator.msMaxTouchPoints instead. If the property exists and returns a value greater than zero, the user’s PC has touch capability. For example:
var hasTouch = navigator.msMaxTouchPoints > 0;
The second addition to the IE10 user agent string is a new architecture token for ARM devices running Windows RT. This complements the existing values for other architectures. The examples below show how this compares to a few other configurations.
  • 32-bit IE10 on 32-bit Windows:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)
  • 32-bit IE10 on 64-bit Windows:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
  • 64-bit IE10 on 64-bit Windows:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Win64; x64; Trident/6.0)
  • IE10 on Windows RT:
    Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; ARM; Trident/6.0)
These additions apply to both desktop and Metro style IE10 since they expose the same platform capabilities. We recommend optimizing your site’s experience around the capabilities of the system (like Touch) through feature detection, rather than browser or environment detection. Where content depends on plug-ins, use the requiresActiveX prompt to help users switch to desktop IE10 until the content can be made plug-in free.
—Tony Ross, Program Manager, Internet Explorer

XMLHttpRequest responseXML in IE10 Release Preview

IE10 in Windows 8 Release Preview updates the responseXML from an XMLHttpRequest to return a native XML document by default. This change applies to IE10’s Standards and Quirks document modes, making them interoperable with other modern browsers and consistent with a “same markup” approach. Compatibility document modes 5, 7, 8, and 9 are unchanged.
This change may impact sites that were expecting responseXML to contain an MSXML document and depended on MSXML-specific functionality such as selectNodes. In these cases, you may request that IE10 return an MSXML by setting the responseType member of your XMLHttpRequest object to 'msxml-document'. If your code does not depend on MSXML-specific functionality, IE10’s native XML document should work for you.
Native XML support in IE9 brought DOM parity to XML and HTML and enabled XML fragments to be inserted and rendered directly within a page (even in HTML). IE9 also simplified converting between XML and DOM with the addition of DOMParser and XMLSerializer. IE10 completes this transition by updating responseXML to return a native XML document.
Like IE9, IE10 previews before the Windows 8 Release Preview returned an MSXML document for responseXML. As a result, retrieving a native document required the additional step of passing responseText to DOMParser.
var xhr = new XMLHttpRequest();
//...
var parser = new DOMParser();
var doc = parser.parseFromString(xhr.responseText, 'text/xml');
// 'doc' contains a native document in both IE9 and IE10
In the Windows 8 Release Preview, IE10 eliminates the need for an additional DOMParser step by returning a native document directly via responseXML. Existing code using DOMParser will continue to work in IE10.
var xhr = new XMLHttpRequest();
//...
var doc = xhr.responseXML;
// 'doc' contains a native document in IE10’s Standards and Quirks document modes
// it contains an MSHTML document in IE9 and in IE10’s compatibility document modes
This simplification also applies to the new response property when responseType is set to 'document'.
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
xhr.responseType = 'document';
//...
var doc = xhr.response;
// 'doc' contains a native document in IE10’s Standards and Quirks document modes
IE10 additionally includes a mechanism to opt-in to retrieving an MSXML document. This can be useful if you still need some MSXML-specific functionality (such as selectNodes) or simply need some extra time to migrate. To do this, set the responseType of your XMLHttpRequest object to 'msxml-document'.
var xhr = new XMLHttpRequest();
xhr.open(method, url, true);
try { xhr.responseType = 'msxml-document'; } catch(e){}
//...
var doc = xhr.responseXML;
// 'doc' now contains an MSXML document in IE10’s Standards and Quirks document modes
In theory the assignment should be ignored by other browsers, but in practice some do throw an exception. You can defend against this using a try/catch statement, as in the above example.
—Tony Ross, Program Manager, Internet Explorer

New Blob Constructor in IE10

IE10 in Windows 8 Release Preview adds support for a Blob constructor. We earlier wrote about and demonstrated IE10’s support for a BlobBuilder interface, an in-progress interface in the File API: Writer W3C Working Draft. This interface enables developers to work with files on the client PC. Recently, the W3C working group deprecated the BlobBuilder interface in favor of a new Blob constructor. This post explains the differences between the two.

Comparing Blob Constructor and BlobBuilder Interface

Both the Blob constructor and the BlobBuilder interface enable Web developers to create files on the client. The difference is in the syntax. Whereas BlobBuilder requires each portion of the blob to be appended during a separate call to the append method, the Blob constructor can take an array of arguments. Here’s how to create a simple text file using both BlobBuilder and the Blob constructor:
// using the Blob constructor
var textBlob1 = new Blob(["Hello", " world!"], { type: "text/plain", endings: "transparent" });

// using the MSBlobBuilder interface
var bb = new MSBlobBuilder();
bb.append("Hello");
bb.append(" world!");
var textBlob2 = bb.getBlob("text/plain");
The Blob constructor takes two arguments, the array of content to put into the blob and an optional dictionary object which can include two members, type and endings. The array of content for the blob may contain blob objects, text strings or array buffers.
Recent versions of Firefox and Chrome also support the Blob constructor. IE10 still supports the prefixed MSBlobBuilder interface in addition to the new Blob constructor. At this time, Firefox and Chrome also support their vendor-prefixed BlobBuilder interface.

Feature Detecting the Blob Constructor

As with all new features, we recommend using feature detection to determine if the Blob constructor is available in the browser your code is running on. You can use something like this:
if (typeof Blob !== "undefined") {
// use the Blob constructor
} else if (window.MSBlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder) {
// use the supported vendor-prefixed BlobBuilder
} else {
// neither Blob constructor nor BlobBuilder is supported
}
If you run the BlobBuilder Test Drive demo with the F12 developer tools console window open, it will log whether the blobs are being built via the Blob constructor or via BlobBuilder.
The addition of the Blob constructor to IE10 enables you to write standards-compliant code that works across browsers.
—Sharon Newman, Program Manager, Internet Explorer