воскресенье, 7 октября 2012 г.

HTML5, and Real World Site Performance: Seventh IE9 Platform Preview Available for Developers


Performance on the web is multi-dimensional. Real websites call on many different browser subsystems to deliver amazing experiences. Each browser subsystem in turn has its own performance characteristics. The chart here and the diagrams in this postdescribe the specific subsystems like JavaScript and graphics rendering and more in detail.
Over the last few weeks, we’ve been tuning the JavaScript engine for more of the patterns we’ve found in real world sites. Based on the progress since the last platform preview, we’re releasing an updated platform preview build today so developers can try it out and provide feedback about the changes. Here’s a video of the changes in action:
Stepping back from these striking differences, let’s look at the big picture. JavaScript performance is one part of one aspect of performance. In addition to the other parts of the browser platform (like graphics rendering), performance involves other aspects as well: how well does the browser guard the user from slow add-ons, or from unreliable sites that crash? Enabling users to pin websites to the Windows taskbar means that users can go directly to sites without having to launch the browser and navigate. Making the most of your device for web browsing is significant as well. Taking advantage of the whole PC, and using the specialized graphics hardware and the many cores that modern PCs typically include, offers huge performance gains.

Tuning the JavaScript Engine for Real world patterns

Real world websites use JavaScript to respond to user input, manipulate strings, and move objects around the screen, and much more. We looked at common patterns and made adjustments to IE9’s script engine. You can try these examples (and more) atwww.ietestdrive.com.
Running these sites in other browsers like the latest Google Chrome or FireFox 4, shows significant performance differences. InShakespeare’s Tag Cloud, you see the performance advantage of compiled JavaScript and ECMAScript5 support with script-intensive operations. IE9 can run through a large body of text and build a tag cloud much more quickly. That same ECMAScript5 support combined with HTML5 Canvas delivers an HTML5 Sudoku solver that can solve puzzles faster than other browsers running the same site. With Galactic, you see fast JavaScript and hardware accelerated graphics together creating a 3D interactive experience. The frame rate in IE9 is significantly better than what the other browsers do today.

The Webkit SunSpider Microbenchmark

One measure of some aspects of JavaScript performance is the Webkit Sunspider microbenchmark. Remember that JavaScript is just one component of many that define browser performance on real world sites. Here is a chart of the latest results:
Webkit Sunspider JavaScript Benchmark Results.  IE9 Platform Preview 7 is fastest followed by Chrome 8 Beta, Opera 11 Alpha, Opera 10.63, Chrome 7, FF 4 Pre-Release, Safari 5.0.2, FF 3.6.12 and IE8.
You may notice that the relative positions of browsers on this chart have changed with the latest IE9 Platform Preview.
We’ve gotten some questions after the last few Platform Previews about this chart. The results in the graph are from running actual browsers (in a consistent lab setup), just as we have since we started publishing the chart. Reporting results that “rely on a ‘shell’ JS engine that runs in a command line” is odd because those results don’t reflect the user’s experience in a browser. Similarly, because the point of a browser is to run actual websites, not just benchmarks, the chart we publish continues to include two versions of each other browser. You can read more on this choice at the end of this post.
You may also notice that the differences between browsers on this microbenchmark are converging within thousandths of a second on tests that repeat operations many, many times to find any differences at all. Some have suggested that this benchmark doesn’t matter now and it’s time for another JavaScript microbenchmark.
We’ve been consistent in our point of view that these tests are at best not very useful, and at worst misleading. Even with the most recent results in the chart above, our motivations and our point of view remain unchanged. We’ve focused on improving real world site performance. We’ve made progress on some microbenchmarks as a side effect. Focusing on another subsystem microbenchmark is not very useful.

Microbenchmarks and Real world web patterns have little in common

We think people should evaluate browser performance with real-world scenarios. Real-world scenarios involve using all the subsystems in the browser together rather than looking at single subsystems in isolation. Using a narrow slice of features to assess the big picture makes as little sense here as using the “Acid” tests to understand standards compliance.
Microbenchmarks isolate very narrow and specific aspects of a system. That’s the opposite of real-world websites that use the different subsystems together in order to deliver something useful or entertaining. Microbenchmark results often have little in common with the actual user experience of sites; for example, comparing JavaScript ray tracing or Fourier transforms is a good measure if that’s what the sites you rely on actually do. Performance on the test drive site samples has not, to date, looked like the Webkit SunSpider graph because there’s more to real world performance than JavaScript. The work at the W3C with other browser developerson a web standard to help developers measure and understand the performance of their website is a powerful statement about how much more there is to performance than JavaScript.
This Channel 9 interview with Jason Weber (a Lead Program Manager on the IE team focused on performance) is worth watching if you’re interested in hearing more about the difference between real world performance and microbenchmarks,
The IE Test Drive site offers samples that run in all browsers and deliberately represent real-world site patterns rather than microbenchmark-style samples. The visualization of the real-world samples is often more fun than a graph, as with Galactic, browser hunt and speed reading. The performance differences between browsers can be striking. They reflect how we’ve designed for real world, end-to-end performance rather than tuning subsystems for microbenchmarks.

Previews with Meaning

Back in March, we committed to delivering public Platform Preview Builds to the developer community on a regular schedule leading up to the IE9 beta. Feedback about these previews from developers has made both the IE9 development process and the IE9 release itself significantly different from previous IE releases.
This latest Platform Preview comes about two and half weeks after the most recent Preview. Leading up to the IE9 beta, we released Platform Previews approximately every eight weeks. We have internal builds of IE at least once a day, often more. Why not release public “dailies” and “nightlies” of IE?
The cadence of IE Platform Previews reflects our point of view: the point of a browser is to run actual websites, not just benchmarks or samples that are hardwired for one browser. Our point of view starts with providing consistent quality to respect customers’ time and includes delivering meaningful progress with each Platform Preview.
Twenty four hours of elapsed time is rarely meaningful. “Nightlies” vary widely in performance and quality, and may not run actual websites successfully. Those daily builds are of some interest to a small audience of “insider” enthusiasts who often take activity (evenincrementing the version number) as progress. The gap between the IE Platform Preview download numbers (in the millions) and the other browsers’ pre-release offerings reflects this difference.
Looking ahead, we will continue to improve IE9’s performance. Making the full power of the PC available to websites is part of our focus on real-world sites and real-world performance. We’ll continue to work with the W3C and other browser developers to deliver on the goal of the same markup (the same HTML, CSS, and script) working across browsers. We’ll continue to take a holistic approach to the browser experience and platform and safety. We’ll also continue to release at a cadence that provides meaningful builds for the community to provide meaningful feedback.
Dean Hachamovitch
Update 1:10pm – There have been some questions raised about how a particular optimization in the Chakra engine is affecting IE9’s Webkit Sunspider results. The below addition addresses these questions.

Dead Code Elimination in JavaScript

One of the changes we made to the IE9 JavaScript Engine, codenamed Chakra, to improve performance on real world web sites involves dead code elimination. Yesterday afternoon, someone posted a question (“What sorts of code does the analysis work on, other than the exact [math-cordic test] function included in SunSpider,”) on the Microsoft Connect feedback site. Given some recent interest in this question, this blog answers that question.
Briefly, the IE9 JavaScript engine includes many different changes to improve the performance of real-world Web sites and applications. You can see this in action by visiting www.ietestdrive.com and trying the samples there with IE9 and other browsers. The behavior of the IE9 JavaScript engine is not a “special case optimization” for any benchmark and not a bug.
Some of the optimizations we’ve made to the JavaScript interpreter/compiler in IE9 are of a type known in the compiler world as dead code elimination. Dead code elimination optimizations look for code that has no effect on a running program, and removes the code from the program. This has a benefit of both reducing the size of the compiled program in memory and running the program faster.
Here is a very simple example of JavaScript code that is a candidate for dead code elimination. Because the conditional will always evaluate to false, the JavaScript engine can eliminate this code altogether.
function func() {
    var x = 1;
    var y = 3;
    var w = x + y;

    if (w != 4) {
        // dead code 
    }
}
Dead code elimination is especially effective when code would be executed many times, as in a loop. In the following example, the code in the loop repeatedly overwrites the same variable (what is known in computer science as a dead store), so it can be reduced to only one call.
function func(a, b) {
    var x;
    var i = 300;
    while (i--) {
        x = a + b; // dead store
    }
}
In the example below, the code executed in the loop is not used anywhere in the program outside the loop, so the entire loop can be safely removed.
function sum() {
    var a = [1, 2, 3, 4, 5];
    var sum = 0.0;
    
    // dead loop elimination
    for (var i = 0; i < 5; i++) {
        sum += a[i];
    }
}
Developers often write dead code without knowing it and can rely on compilers to optimize the code. Most modern compilers today run an extensive set of dead code elimination optimizations.
So, why does this affect the math-cordic benchmark in the Webkit SunSpider suite? Let’s take a look at the inner function in the test.
function cordicsincos() { 
     var X;  
     var Y;  
     var TargetAngle; 
     var CurrAngle;  
     var Step;   
     X = FIXED(AG_CONST);         /* AG_CONST * cos(0) */ 
     Y = 0;                       /* AG_CONST * sin(0) */ 
   
    TargetAngle = FIXED(28.027);  
    CurrAngle = 0;  
    for (Step = 0; Step < 12; Step++) { 
        var NewX; 
            if (TargetAngle > CurrAngle) { 
               NewX = X - (Y >> Step);  
               Y = (X >> Step) + Y; 
               X = NewX; 
               CurrAngle += Angles[Step];  
            } else { 
               NewX = X + (Y >> Step); 
               Y = -(X >> Step) + Y; 
               X = NewX; 
               CurrAngle -= Angles[Step]; 
            } 
    } 
} 
The benchmark runs an expensive loop, and then does nothing with the results; the benchmark is written exactly in a way that triggers this general optimization.
Of course, the benchmark could be rewritten to avoid triggering this optimization, which would bring our performance on this specific benchmark in line with other browsers.
The interest in this issue is a great example of why these microbenchmarks fail to represent the real world web. Webkit Sunspider uses an expensive JavaScript loop to approximate sine and cosine. Real world sites would actually use the much faster and CPU-optimized functions already available in JavaScript engines.
These optimizations are relatively new to the world of JavaScript runtimes even though there are many examples of dead code in real-world JavaScript on the Web. These optimizations often require significant flow analysis of the code, and in a real world site, spending too much time analyzing code can reduce the responsiveness of the page. The Chakra engine picks the right balance between code quality and analysis time, and only performs a small set of dead code optimizations. We continue to tune this for IE9, and bugs reported via Microsoft Connect are examples of where the optimization could do more. We continue to tune these and other optimizations for the final release.
This kind of dead code elimination is one of many optimizations that Chakra makes to reduce unnecessary work. Over the next few days we’ll post about some of the other techniques Chakra uses to deliver great performance.

Updates for Internet Explorer 9 Beta


Today we released a recommended update for all Internet Explorer 9 Beta customers via Windows Update (KB2448827). This update includes stability fixes for the beta build. It is not a new Internet Explorer 9 Beta build. Another update shipped today (KB2452648) resolves issues between the IE9 send feedback feature on 64-bit machines with Windows-Live-Essentials 11.  These updates apply only to Internet Explorer 9 Beta.
Customers who have automatic updating enabled will not need to take any action because this update will be downloaded and installed automatically. Customers who have not enabled automatic updating need to check for updates and install this update manually. For information about specific configuration options in automatic updating, see Microsoft Knowledge Base Article 294871.
Thank you for your continued support and feedback.
Tyson Storey
Program Manager

Web Standards development at the W3C TPAC 2010


Last year I wrote about the W3C’s annual Technical Plenary and Advisory Committee (TPAC) conference. This is where most of the W3C working groups get together for a week of face to face meetings and networking. TPAC 2010 was a couple of weeks ago and here I will highlight some of the topics discussed by the groups where we participate.
The W3C has a long history as the venue for agreeing on web standards and continues to be the place where the most important web standards are developed. We're actively engaged in the development of many web standards at the W3C and, as part of that work, we sent a dozen people from Microsoft to represent Internet Explorer at TPAC this year.
The consistent theme at TPAC 2010 is that working groups are making significant progress on completing the most important next generation of web standards: moving key specifications towards Last Call and a focus on defining test suites that measure the completeness of implementations. At the same time there is renewed attention on innovating for the future of the web at the W3C.

Working Group Reports

The CSS working group (minutes part1 part2 part3 part4) discussed the progress of the CSS 2.1 specification and test suite and added more detail to the plan to finish this work. Based on feedback generated from completing the last set of implementation reports, the group has updated the test suite and expects one more round of feedback and review. The group is on track to move CSS 2.1 to Recommendation early in 2011.
The work in this group is a good example of closing down a key specification while innovating for the future. Once CSS 2.1 is complete, the group will be able to focus all its time on progressing CSS3 modules. CSS3 isn’t a single monolithic document like CSS 2.1. Instead it is a series of modules each providing a set of features that builds upon the CSS 2.1 foundation. During the meeting we presented anew proposal for Grid Layout in CSS3. The group agreed to move the spec to w3.org as an Editor’s Draft, the very first step of the standardisation process, and the discussions continue about how to proceed.
Example of Grid Layout proposal showing growth in grid due to increase in available space
Example of Grid Layout proposal showing growth in grid due to increase in available space
The Fonts working group (minutes part1 part2) made further progress on the WOFF specification that allows custom fonts to be included in your pages. You can see how IE9 supports WOFF on the IE Test Drive. The WOFF spec moved to Last Call indicating that it is functionally complete and ready for wider review.
Location based services and applications are increasingly important to the modern web. The Geolocation working group (minutes) spent time working through the issues list for the Geolocation API specification. There was a discussion about how the working group will continue its work and the features that might be in the next version of the API.
The HTML working group (minutes track1 track2) discussed a wide range of topics. The group uses an unconference meeting style and typically runs two parallel meeting tracks. Two of the key sessions were related to accessibility and testing. There was more discussion of how to support media accessibility and the measures to provide improved accessibility for canvas. The working group continues to make good progress moving HTML5 towards Last Call according to the timetable established in September.
There were two sessions on testing related to the HTML5 test suite. The group worked through the process of creating tests and discussed the test harness used by tests. Anyone can submit tests (with the appropriate license assignment) so if you’re interested in helping you should start with the instructions on the Wiki.
The SVG working group (minutes part1 part2) also discussed testing and how to move forward with the SVG 1.1 Second Edition test suite. As we’ve discussed before, some of the SVG features overlap with CSS3 modules and there was a meeting of the joint “Effects” task force between the SVG and CSS working groups. The task force discussed how to make progress on specs for transforms, transitions, animations, and filters.
The WebApps working group (minutes part1 part2) spent a significant amount of time discussing database specifications. The groupdecided to issue a Call for Consensus to transition the WebSQL specification to be a Working Group Note. This means that the spec will make no further progress along the standards track. Instead, the group spent the majority of the time discussing issues with theIndexed DB specification. There wasn’t enough time to cover everything during the main WebApps meeting and so members from Google, Microsoft and Mozilla had a breakout session to continue the discussion and work on the remaining issues. We made good progress at TPAC and the specification looks set to move to Last Call early in 2011.

Technical Plenary Day

On the Wednesday of TPAC there was a plenary session. Here the members of all the working groups present joined together for a series of panel discussions and 3-minute “lightning talks”. This was a great opportunity for cross-group discussions between the different working groups.
On the morning of the plenary, there were browser demonstrations from Microsoft, Opera, and Mozilla. Frank Olivier from the Internet Explorer team showed some of the uses of W3C HTML5 on the sites featured on the Beauty of the Web showcase and also highlighted the CSS3 2D Transforms support shown in Flickr Postcards and included in IE9 Platform Preview 6.
The next session was a panel discussion on the future of HTML including thoughts about what “HTML6” might be. Patrick Dengler, another Program Manager on the IE team, gave a presentation based on a paper he had submitted. He discussed the need to bring sound engineering principles to the development of web standards. We all build software and web sites based on use cases, scenarios, and modular design and Patrick talked about how the process we follow as we build the next generation of web standards at W3C should also follow these principles.

What Next?

There is tremendous progress happening at the W3C across a broad range of important web standards. The large amount of activity in all the face-to-face meetings generates a lot of follow-on work. For example, W3C extended both the CSS and Geolocation working group charters and the WOFF spec went to Last Call. There is much more for the web community and the working groups to do together in the year ahead. We're excited to be part of that work and we will continue to provide updates through the IE Blog.
Adrian Bateman
Program Manager

Selectively Filtering Content in Web Browsers


Typically the job of a web browser is to download and display content-- establishing a network connection, sending HTTP requests, retrieving the web page, and downloading and running all of its content. These operations pose non-trivial challenges, and as such, web-browsers are among the most complicated software that most of us routinely use. However, there’s a whole separate (higher level!) challenge around selectively not running (filtering) content.
Today, different browsers offer many different mechanisms for selectively filtering content. This post is a survey of how these mechanisms work, and the subtle and sometimes not so subtle differences between them.

Examples and Motivations

Different users have shown an interest in myriad different types of Content Blocking, and not all users have similar goals.
Certain types of blockers are over a decade old and extremely commonly used (e.g. popup-blockers) while others are less often used or only of interest to a small niche audience. Just reading the comments on this blog, it’s clear that some users want to be able to block cookies, plugins or ActiveX controls, certain types of content (e.g. malware, adult content), privacy-impactful “trackers” (e.g. “web beacons”), advertisements, file downloads, or content they consider “annoying” (e.g. popups, flashing content). Individual consumers may have many different reasons for wanting to block particular content: faster performance, improved security, increased reliability and stability, enhanced privacy, increased battery life, preference about user-experience, legal or supervisory requirements (e.g. parental controls) lower bandwidth charges, as well as many others.
However, on the other end of the internet connection, a website provider may or may not want content blocked, for any of any number of reasons: revenue (direct or indirect), site analytics and understanding customers and markets, predictability and reliability of the user experience, malicious intent, and many others.
In some scenarios, site publishers and developers are just fine with content blocking and modification. For instance, a site owner whose legitimate site was compromised to serve malware probably wants that malware content blocked to keep his visitors safe until the site can be cleaned. Accessibility tools are crucial for some people to use the web and websites. Some sites and networks may offer users a way for to opt-out of analytics or other tracking.
With hundreds of millions of unique browser users, billions of webpages, and myriad different stakeholders in any given webpage visit, the complexity of this topic is clear.
This blog post offers an engineering point of view on the technical aspects of content blocking to help inform the broader discussion. There are many, many other points of view on these issues around the web in general and on this topic.
One trend that is clear is that over time we see demand for browsers to integrate functionality that used to be available via add-ons. Back in 2002, I released a moderately successful IE add-on popup-blocker. PopupPopper remained popular for a few years until Windows XP SP2’s IE6 included an integrated popup blocker.

Mechanisms for Blocking Content

Before we dive in, let’s distinguish between two different approaches for identifying content to block. A heuristic blocker relies on “rules” (heuristics) or other computer-generated information to determine what content to block. A curated blocker relies upon a human being (somewhere) to make that determination.
Heuristics can tell a cookie from an image from some web page content, but they can’t determine the intent or use of any of these. Was the “ps” cookie set so that I don’t have to remember my login, or is it a cookie used to track me… or both? Is an image on the webpage a photo of my brother’s new car, or is it an advertisement, or is it a web beacon used to track me? At best, heuristics can take a guess. The advantage of a heuristic blocker is that it can block things it hasn’t seen before as long as it is similar to other content the user is trying to block; the disadvantage is that heuristics can misfire.
In contrast, a curated blocker uses a person’s judgment to determine what to block. The advantage is improved accuracy, with the disadvantage of a lot of work to keep the list up-to-date with the new content available on the web.
With that distinction in place, let’s look at heuristic and curated blockers as they’re implemented today.
There are three major categories of content blockers: Network-level blockers, Browser reconfiguration/filtering, and Browser Content Blocking add-ons.
Each has its strengths and limitations, outlined in the sections below.

Blocking at the Network Level

There are several common ways to block content at the network level—the most common are by using the HOSTS file, or by filtering content with a proxy. There are a number of other, less-common network-level approaches, including using a router to block particular content (most Linksys routers can be configured to block Java, ActiveX installers, and cookies, for example). Large organizations or networks with restricted bandwidth, for instance, may block content at the gateway:
A content-blocking gateway appliance blocks and advertisement
Blocking content at the network has a number of advantages, including the fact that it will work regardless of which browser you use, and does not require browser-specific add-ons. Network blocking also has a number of disadvantages, primarily because download requests do not contain much context about how the content being requested will be used.

The HOSTS File

Blocking via the HOSTS file works by altering how your computer maps web addresses to actual web sites. Specifically, requests for information to particular addresses (hostnames) like “www.example.com” are directed to other addresses, perhaps on your local computer (aka “127.0.0.1”). When your browser dutifully tries to download particular content, the browser attempts to retrieve it from a location that won’t respond. Because the request is effectively to “a wrong number” (to use a telephone analogy), it fails to return any web content and effectively blocks the content.
By definition, the HOSTS file is a curated block list that cannot easily be computer-generated. However, many organizations publish HOSTS files to block particular sites; one of the most popular such files is here.
There are a number of downsides to this approach, including:
  • It’s non-trivial for most users. Updating the HOSTS file on Vista and above requires elevating to admin and editing a hidden system file in the windows\system32\drivers\etc folder.
  • It’s non-granular. You cannot block a specific path, you can only block all files from a given hostname.
  • It doesn’t work if your connection to the internet goes through a proxy server (e.g. at a school or many businesses). When you are behind a proxy, the proxy performs DNS lookups on your behalf, and the local HOSTS file is ignored.
  • Your machine configuration matters. If you happen to be running a web server locally (or have an unusual firewall configuration), performance may be impaired.
  • It’s trivially detectable. Because the browser will trigger an error (e.g. the OnError event) when content fails to load, JavaScript can detect the blockage and react.

Filtering with a Proxy

When you configure your browser to use a content-filtering proxy, the proxy can simply decline to return that specific content, or return a replacement file instead of the server’s content. Because the proxy sees the full URL of the content, a proxy can easily block a file named “tracker.js” on every server, or return a blank image for any requests for “/adult/*.gif.” This granularity can be useful when blocking content, because it allows for heuristics that work across multiple hostnames, and it allows blocking subsets of content from a given host in the case that a site serves both wanted and unwanted content.
There are a number of downsides to this approach, including:
  • Browser configuration. Browsers must be configured to use a proxy; most browsers adopt WinINET/IE’s proxy settings, but not all do.
  • Performance. Proxying traffic incurs some overhead, particularly because browsers limit the number of simultaneous connections to a proxy.
  • Most don’t work with HTTPS. Only proxies configured to decrypt HTTPS traffic can block individual files delivered over HTTPS. Other proxies can only entirely prevent HTTPS connections to target servers.
There are a number of content-filtering proxies available. Two of the most popular, the Internet JunkBuster Proxy and Proxomitron are no longer developed. Privoxy and others are still under development, and do-it-yourselfers can experiment with or build upon the trivial Content-Block extension for Fiddler.
Proxy-based blockers can use either heuristics or a curated block list, or even a combination of both strategies.

Blocking via Browser Configuration

One of the simplest ways to block unwanted content is to use existing features built-in to the browser. Most browsers offer the ability to disable certain features altogether, and some offer the ability to control certain features on a per-site basis. Internet Explorer offers the following features that allow the user to block unwanted content:
  • Zones Configuration
  • Per-Site ActiveX
  • InPrivate Filtering
  • Cookie Controls
  • InPrivate Browsing / Delete Browsing History
  • The Popup-Blocker
These features offer differing levels of control and granularity, and each blocks only certain types of content. Some of the features are based on heuristics (e.g. the contents of a P3P file or configuration setting) while others require the user or another curator to determine the desired policy.

Zones Configuration

Internet Explorer uses the concept of Security Zones to decide what privileges content from a given site may use. By adjusting the privileges on a per-zone basis, and by selecting which Zone a given site runs in, the user has a powerful level of control over what the site may do.
There are myriad possible configurations that may be used, but the simplest is to place sites from which to block content in the Restricted Sites Zone. Content from the Restricted Sites zone runs with very few permissions, and may not send or store cookies, serve script, run script from other sites, load ActiveX controls, or download files. For instance, if you place *.google-analytics.com in the Restricted Sites zone, script from that server may not run on any other page, and cookies are not sent or stored from that server.
The user-interface for adding sites to the Restricted Zone is simple to use, and can even be controlled by Group Policy.
However, using Zones to restrict unwanted content has a number of downsides:
  • Network Performance. Because content is still downloaded even if it is not used, using the Restricted Zone does not fully recoup the performance impact of unwanted content
  • Content is restricted, not necessarily blocked. For instance, script from a site in the Restricted Zone is not run, but images from that zone will still be shown. A sufficiently dedicated tracking technology could associate an HTTP request from the user event though no cookies are sent.
  • Scale is limited. The Restricted Zone UI and data structures were designed for a personal scale, not internet-scale lists of sites. Listing more than a few hundred sites will begin to slow down browser startup performance. For instance, one product automatically injects 10000 sites in the Restricted Zone, which significantly impacts Internet Explorer’s performance.
We commonly get requests to convert the Restricted Sites zone into a “blackhole zone” that has no permissions, including permission to make network requests. That won’t work, because Security-Restricted IFRAMES, for instance, use the Restricted Zone settings and they must be able to render content (or they become ineffective for what developers expect them to do). Another suggestion is to create a new Zone solely for content-blocking, but unfortunately this would be difficult because many programs and frameworks are hardcoded to the current set of Zones and behave very poorly if a new Zone appears.

Per-Site ActiveX Configuration

Users who wish to control Flash, Silverlight, Java, or other plug-ins in Internet Explorer can use the Per-Site ActiveX feature of IE8 to control which sites may display such content. By removing the * from the list of allowed sites for an add-on, the user will receive a prompt on any site that attempts to use the add-on. Unless the user adds the site to the approved list, the add-on will not run on that site.
There are a number of weaknesses to using Per-Site ActiveX to block content:
  • UI Annoyance – Because the Information Bar lacks a “Never for this site” option, users will always see this prompt on any site for which the add-on is not approved
  • Manageability – The user-interface for the Allow List is buried deep within Manage Add-ons, and also does not offer a “Never” option. The UI does not allow users to remove individual sites from the Allow list; the only option is to clear the entire list.
Nevertheless, this can be a powerful feature for restricting which sites may use a given browser add-on with more granularity than the legacy “Enable / Disable” option that controls whether an ActiveX control could run at all.

InPrivate Filtering

Internet Explorer’s InPrivate Filtering feature detects and optionally blocks 3rd party content to help consumers exercise control over their browsing information. The feature can operate in either a heuristic or curated mode at the user’s choice.
Third-party content that appears across multiple sites is presented for the user’s review, and the user may choose to allow or block such content. When the user chooses to block that content, Internet Explorer will no longer make requests to the target URL when it is third-party content on the page. Unless the user visits that URL directly, IE will not visit that URL to get content from it. This is an effective mitigation for people concerned about the risk of sharing information with potential tracking sites. By default, InPrivate Filtering is off, and users need to explicitly choose to turn it on each time they run the browser.
InPrivate Filtering offers the ability to import lists of sites to block, which appears to be a popular feature in some circles.
The user may further configure InPrivate Filtering to “Automatically block” content from a 3rd party context when a certain threshold number of uses is reached. So, for instance, the user can configure IE to block third-party content which is used by 5 or more unrelated sites.
The downsides of the heruistic or “Automatically block” mechanism are clear:
  • No way to determine intent. There’s no way for a browser to know whether or not a given piece of content (e.g. a “share this link!” widget) is being used to track you, or is used for a harmless purpose. Hence, content may be blocked as a “possible tracker” unnecessarily.
  • Shared script repositories break. Big companies like Microsoft and Google host popular JavaScript libraries like JQuery on fast CDN servers and invite other websites to reuse those libraries. This is great for performance (because the user is likely to have the library stored in their cache) but is indistinguishable from a tracker. If a needed script is automatically blocked, the page which relies upon it will break.
The InPrivate Filtering feature is controlled on a per-Zone basis, when opted-in the filtering is applied to the Internet and Restricted Zones only.

Cookie Controls

As I blogged back in June, Internet Explorer offers an extremely rich set of controls for cookies that allow users to specify simple options like “Block all cookies from example.com” to advanced options like “Discard all 3rd party cookies at the end of the browser session.” Cookies are also controlled by Zone privileges. By default, cookies are unconditionally permitted in the Local Computer and Intranet zones, subjected to cookie controls in the Internet and Trusted Zones, and blocked entirely in the Restricted Zone.

InPrivate Browsing / Delete Browsing History

The InPrivate Browsing and Delete Browser History features can be used to prevent storage of unwanted cookies or other information. The new “Delete browsing history on exit” checkbox in IE8 allows the user to delete unwanted content at the end of each browser session. The “Preserve Favorites website data” option allows preservation of desired content while wiping everything else.

The Popup Blocker

Internet Explorer 6 on Windows XP SP2 introduced the popup blocker. The popup blocker includes a number of configuration options which can be found inside the Tools > Internet Options > Privacy settings dialog. The configuration settings for the Popup Blocker are stored inside the HKCU\Software\Microsoft\Internet Explorer\New Windows\ registry key, including the list of sites that are permitted to launch popup windows. The Popup Blocker is enabled on a per-Zone basis, and applies (by default) to pages in the Internet, Trusted, and Restricted Zones.

Blocking via Add-ons

In some cases, enthusiasts are not satisfied with the options provided by built-in browser controls and have built a variety of different add-ons to block content.  Some add-ons automatically block content (using either heuristics or a curated block list) before it is downloaded, while other add-ons simply remove unwanted content after it has been loaded.

Automatic Blocking

Automatic blockers tend to inject themselves into the browser’s download subsystem and watch for requests to unwanted content; such requests are then terminated or a locally-generated placeholder is returned. Less commonly, such add-ons will scan the DOM of the currently loaded document and remove content which matches some pattern (e.g. images within a DIV named “adultcontent”).
Content blocking add-ons for IE include: Simple Ad-Block, IE7Pro, AdBlockIE, Adblock Pro, as well as many others. The downside of these add-ons is the downside of add-ons across all browsers: performance and reliability. Many of these add-ons use mechanisms that do not follow the IE Add-on Guidelines and Requirements and depend upon unsupported and fragile “thunking” of private browser APIs.

Manual Blocking

In contrast to the Automatic Blockers, Manual Blockers allow the user to remove unwanted content from the current page after it has been loaded. These blockers are often simpler to develop although their capabilities are usually limited—often they simply serve as a streamlined user-interface that configures existing browser features.
The advantage of Manual Blockers is that they typically only do work when invoked, and thus tend to be faster and more reliable. The disadvantage is that, because they tend to run after the content is loaded, users still pay the penalty of initially downloading the unwanted content.

Evaluation of Blocking Mechanisms

Each of the blocking mechanisms listed above has one or more downsides.
Perhaps the biggest risk is to the user’s experience when interacting with a site whose content is blocked. Commonly, browsing enthusiasts may configure a blocking mechanism and generally enjoy its benefits, but then later waste a great deal of time trying to figure out why some site they care about isn’t working correctly. In some cases, the user experiences a “doh!” moment, guesses that blocked content may be causing a problem, and subsequently adjusts the blocking mechanism to fix the site. In other cases, the user may never suspect that content-blocking has caused a problem, and the resultant breakage may lead the user to abandon using the site or the web browser thinking that one or the other is “buggy.”
Carefully curated blocking mechanisms are somewhat less likely to cause site-compatibility problems than heuristic approaches because software cannot readily determine intent in the same way that a human can. Curated lists can be burdensome for the author and user to maintain.
As websites evolve, both curated and heuristic blocking mechanisms may become less effective.

Content Blocking and Site Evolution: A Case Study

Let’s look at how sites and one particular mechanism for content blocking (popup blockers) evolved over time in practice on the web. The history of popups and popup-blockers is a great case to study, because while popups are now somewhat rare, they used to be everywhere.
Back in the early days of popup blockers, I once visited a small tech news site. After a popup from the site was blocked, I saw the following alert:
Alert dialog warning the user to disable their popup blocker
At the time, I didn’t think much of this warning. Thirty seconds later, the site attempted to show another popup, and upon failure, it embarked on a primitive denial of service attack. An endless stream of alert dialogs was presented, preventing further use of the browser window:
An endless stream of alerts
Now, this sort of site response certainly isn’t common today, but nevertheless many sites will detect when content they insist upon delivering is not delivered. The site may have any of a number of reasons – perhaps artistic integrity of their content or a contractual obligation. As with most issues on the web, there are many points of view: consumer, site, security, accessibility, IT, and more.
This gets back to the point above about what software can recognize: data types and patterns, not intent. So, if you as a user configure blocking of content through one of the above mechanisms, understand that sites, historically, have responded, and we are still living with back and forth on something as old as popup blockers. Here’s another example.
Sometimes you want a click on a web page to result in a new window. For example, when you click on the “Reply” button in your web mail application, you may expect that to open a new window to allow you to compose a message. However, some sites use (or co-opt) that click in order to launch a popup, bypassing the popup blocker.
For instance, if you visit the online Dilbert comic today, you will likely see a notification that a popup has been blocked. If you subsequently click anywhere in that page, a JavaScript file delivered from casalemedia.com reacts to that click by spawning an advertisement delivered by a content delivery network. This popup is not blocked because the click is a User-Initiated Action, which temporarily disables the popup blocker by default. While the user may be able to block the advertisement by taking note of the hostname in the popup (optmd.com), blocking that site will only block the content of the popup, and not the popup itself. Only by examining network traffic can a savvy user determine which site to block in order to prevent the popup-blocker-circumvention JavaScript from running. While IE’s popup blocker can be configured to block (actually, not exempt) popups that are a result of a User-Initiated Action (Tools > Options > Privacy > Settings > Blocking Level: High) this setting makes it much more cumbersome to use sites that rely upon this mechanism for popups the user actually solicited.
Similarly, some sites have responded to content blockers that focus on advertisements. For instance, one of the top five web mail sites will detect if an advertisement has been blocked, and if so, it will simply try loading a different advertisement from a different ad-server, rotating between five or more different advertising providers hoping to find an unblocked host. Similarly, one of the most popular online advertisers will detect when in-page advertisements have been blocked, and rather than taking the user to the next page when reading a multi-page story, the site will instead present a full-page interstitial advertisement with a count-down timer. While this advertisement too can be blocked, the page itself typically is not, leading to a degraded user-experience. Some smaller sites were so incensed by the use of ad-blockers in Firefox that they simply banned all Firefox users, redirecting to a lengthy tirade. In a recent development, one firm now delivers ads as a part of a CAPTCHA test—blocking the ad means you cannot use the site.
The update cycle, back and forth, between browsers and sites can take many years. For instance, only relatively recently did the Outlook Web Access team introduce a version that prevents popup-blockers from breaking their user-experience, and many other web applications have yet to make such updates. This is particularly troublesome because unblocking popups causes a page refresh to occur (any JavaScript that was trying to manipulate the popup would have failed to run when it was blocked, so a refresh is required to ensure the script runs properly). Refreshing the pages of many web applications in this way causes them to lose important state information.
Unfortunately, some sites will likely evolve to circumvent blockers against the user’s preferences, while other web applications may not bother to detect or mitigate content blocking, leading to an impaired user-experience.

-Eric Lawrence

Building World-ready Applications in JavaScript Becoming a Reality


We consistently hear from developers that today’s JavaScript standard lacks a few basic objects and library helpers that are vital for building rich, world-wide Web applications. Last year, we shared a reference implementation of an emerging proposal for anInternationalization API for JavaScript. This API introduces support for number formatting, date and time formatting, and locale sensitive collation or string comparison. Given that this limitation fundamentally prevents world-ready sites from being written interoperably on the standards Web platform; the working group, which includes members from Amazon, Google, Mozilla, and Microsoft, have collaborated to finalize the draft specification ahead of the draft ECMAScript 6 specification. A couple of weeks ago, the standards committee met in the Computer Science department on the campus of Northeastern University and finalized the proposed API. We have updated our reference implementation to match the current draft of the specification.
We’ve also published a demo to illustrate the use of this API in to visualize Foreign Currency Exchange. This is a common Web scenario that today has to be written using a plug-in, a browser extension, or through interaction with the server. Play with the demo, open the JavaScript console to interact with the API, and give us feedback.

Charting Historical Foreign Currency Exchange with the Internationalization API

Perusing sites like Google Finance, Yahoo Finance, FXCM, ForXCharts, and other ForEx sites, a pattern emerges: all of these sites implement their user experience using a combination of plug-ins, extensions, or constructs which require server round-tripping for interactivity. Because these sites need to format currencies, present dates according to a specific locale, and sort strings like stock tickers with locale specific string comparison, the Web platform comes up short for them today.

1) Yahoo Finance ForEx Chart using Flash to format numbers 2) Google Finance using Flash to format DateTime
Aside from the ActiveX control which provides support for the API, the user experience of our ForEx test drive demo is written 100% in JavaScript. It uses jqPlot to chart the currency exchanges format dates and currencies in JavaScript. At the top of the demo, you can pick a Foreign Exchange pair, such as comparing EUR/JPY and view it with a locale specific date format by selecting the ja-JP-u-nu-latin language tag. When you hit the “Plot with Intl” you’ll see the JavaScript API in action.

Overview of the JavaScript Internationalization API

Web applications are harder to globalize than native applications because JavaScript does not provide access the native date and currency formats in the underlying OS. All JavaScript implementations run on top of operating systems that include comprehensive internationalization libraries that have varying degrees of support. With the introduction of this API, there will be a standard interface for accessing these libraries. The internationalization library in Windows 8 includes support for 364 available locales, 18 numbering systems, many date patterns, and includes support for the Gregorian, Islamic, Hebrew, Buddhist, Korean, and Japanese calendars.
For the purpose of this test drive demo, the reference implementation of the emerging standard is implemented as an ActiveX extension, but once installed and enabled it works just like the planned JavaScript API will work. You can even experiment with it in the JavaScript console window.
The API itself enables three basic capabilities to the Web platform:
  • Number formatting – Format numbers with specified decimal lengths or as a currency or percentage
  • Date and Time formatting – Converts a time value into a string provided inputs of time zone, second, minute, hour, day, month, year, weekday, or era
  • Ordinal String Comparison – Formally known as collation which does locale specific string comparison
Below you can find an example of the API in action:
// Number formatting
var nf = new Intl.NumberFormat(["en-US"], {
    style: "currency",
    currency: "CNY",
    currencyDisplay: "symbol",
    maxmimumFractionDigit: 1
})

nf.format(100); // "¥100.00"

// Date formatting
var dtf = new Intl.DateTimeFormat(["ar-SA-u-ca-islamic-nu-latin"], {
    weekday: "long"
});
dtf.format(new Date()); // Prints today's week day in long format

//Collation sample
var co = new Intl.Collator(["de-DE-u-co-phonebk"]);
co.compare("a", "b"); // returns -1

Next steps for the ECMAScript Standard

While the internationalization API is in the process of being ratified, the standards committee continues to refine the list of proposalsfor the next version of the standard, ECMAScript 6, which is targeted to be completed in 2013. As with the internationalization API, we welcome feedback on these proposals to ensure that we’re able to faithfully represent the needs of Web developers when the standards committee meets every few months.
The best way to get a feel for the proposals is to experiment with the reference implementations. We encourage you to play with thesample app or play with the prototype API in the JavaScript console to see how it feels. Once you’ve tried it out, let us know if you have any feedback or suggestions. We look forward to improving JavaScript and making it ever easier to build great Web applications using standard APIs.
— Suresh Jayabalan & Amanda Silver, Program Managers, JavaScript Team