May 26

There is a lot of solid support for cross-domain Ajax in modern web browsers, yet most developers are still unaware of this powerful capability. Usage requires just a little bit of extra JavaScript work and a little extra server-side work to ensure that the correct headers are being sent. IE8’s implementation lags a bit behind the others in terms of allowing advanced requests and credentialed requests, but hopefully support for CORS will continue to improve.

Nicholas C. Zakas concludes the above in his post on cross domain with cross origin resource sharing (and XDR for IE).

He shares some simple code:

JAVASCRIPT:

function createCORSRequest(method, url){
    var xhr = new XMLHttpRequest();
    if (“withCredentials” in xhr){
        xhr.open(method, url, true);
    } else if (typeof XDomainRequest != “undefined”){
        xhr = new XDomainRequest();
        xhr.open(method, url);
    } else {
        xhr = null;
    }
    return xhr;
}

var request = createCORSRequest(“get”, “http://www.nczonline.net/”);
if (request){
    request.onload = function(){
        //do something with request.responseText
    };
    request.send();
}
 

to do the work of cross domain.

Read the detail for the various headers and tweaks, and then check out the CORS demo page by Arun of Mozilla.

Continue reading »

Tagged with:
May 19


There’s an old saying: “It took me ten years to be an overnight success.” We’ve been waiting for web fonts for at least a decade, and 2010 will finally be the year that web fonts go mainstream.

This is in no small part to the work both Typekit and Google have been doing. Today they both announced some very cool things in this area.

First up, Google announced that they are releasing high quality open source fonts in the Google Font Directory. Since these are open source you can even download the original font files yourself at the font code.google.com project.

Next, Google has made it very easy to include these fonts into your page using the new Google Font API. To use a font you simply drop some HTML into your page similar to the following, specifying the font you want to use:

HTML:

<link href=‘http://fonts.googleapis.com/css?family=Tangerine’
      rel=‘stylesheet’
      type=‘text/css’>

body { font-family: ‘Tangerine’, serif; }

Doesn’t get simpler than that. The new API does alot of things for you behind the scenes:

Google’s serving infrastructure takes care of converting the font into a format compatible with any modern browser (including Internet Explorer 6 and up), sends just the styles and weights you select, and the font files and CSS are tuned and optimized for web serving. For example, cache headers are set to maximize the likelihood that the fonts will be served from the browser’s cache with no need for a network roundtrip, even when the same font is linked from different websites.

These fonts also work well with CSS3 and HTML5 styling, including drop shadows, rotation, etc. In addition, selecting these fonts in your CSS works just the same as for locally installed fonts, facilitating clean separation of content and presentation.

On a related front, Typekit and Google announced a new Web Font Loader that smooths over many of the differences around loading web fonts on a page:

The WebFont Loader puts the developer in control of how web fonts are handled by various browsers. The API fires JavaScript events at certain points, for example when the web font completes downloading. With these events, developers can control how web fonts behave on a site so that they download consistently across all browsers. In addition, developers can set the fallback font’s size to more closely match the web font, so content doesn’t reflow after loading.

Furthermore, the WebFont Loader is designed to make it easy to switch between different providers of web fonts, including Google, Typekit, and others. The code is modular, and we expect to add modules for other major web font providers in coming weeks.

It’s great to see Typekit involved in this; they are a real pioneer in this area and have helped make fonts on the web a reality.

To see all these pieces together navigate over to Smashing Magazine which relaunched their site using these technologies.

Congrats to the Google Web Fonts and Themes team, including Raph Levien, Jeremie Lenfant-Engelmann, Marc Tobias Kunisch, Meslissa Louie, and David Kuettel.

[Disclosure: I work for Google and know the Web Fonts team. However, even if I didn't, I would still be excited about this since I've been waiting for web fonts to happen since the 90s!]

Continue reading »

Tagged with:
May 19

The WebM project is dedicated to developing a high-quality, open video format for the web that is freely available to everyone.

The WebM launch is supported by Mozilla, Opera, Google and more than forty other publishers, software and hardware vendors.

WebM is an open, royalty-free, media file format designed for the web.

WebM defines the file container structure, video and audio formats. WebM files consist of video streams compressed with the VP8 video codec and audio streams compressed with the Vorbis audio codec. The WebM file structure is based on the Matroska container.

It happened. Today, Google is up on stage at I/O unveiling a new WebM project alongside a slew of partners (notably: Mozilla and Opera on the browser side) that gets the On2 codec out into the open. This is huge news for the fight for Open Video, and everyone will now have eyes on Safari and IE. Microsoft posted a month back about their stance, probably to get it out before this announcement. If folks don’t support this….. it is weak.

YouTube will be a huge push here, and you can go to their html5 version: http://www.youtube.com/html5 and check it out. Today it is available in trunk builds on Chromium and Firefox. Soon, an Opera beta, Chrome dev release, and more.

The project is going after:

  • Openness and innovation. A key factor in the web’s success is
    that its core technologies such as HTML, HTTP, and TCP/IP are open
    for anyone to implement and improve. With video being core to the
    web experience, a high-quality, open video format choice is needed.
    WebM is 100% free, and open-sourced under a
    BSD-style license.

  • Optimized for the web. Serving video on the web is different
    from traditional broadcast and offline mediums. Existing video
    formats were designed to serve the needs of these mediums and do
    it very well. WebM is focused on addressing the unique needs of
    serving video on the web.

    • Low computational footprint to enable playback on any device,
      including low-power netbooks, handhelds, tablets, etc.*

    • Simple container format

    • Highest quality real-time video delivery

    • Click and encode. Minimal codec profiles, sub-options; when
      possible, let the encoder make the tough choices.

* Note: The initial developer preview releases of browsers supporting WebM are not yet fully optimized and therefore have a higher computational footprint for screen rendering than we expect for the general releases. The computational efficiencies of WebM are more accurately measured today using the development tools in the VP8 SDKs. Optimizations of the browser implementations are forthcoming.

Congrats Open Web.

Continue reading »

Tagged with:
May 03

Mark Pilgrim continues to create fantastic content for his Dive Into HTML5 book. His latest is on HTML extensibility.

Some folks tried to get us to use RDFa in XHTML (and try to get us doing it in HTML5 too… :/), and we have had the micro-formats folks take a pragmatic approach.

The new microdata work in HTML5 formalizes some of this, as you can see in this fully marked up ‘person’:

HTML:

  1.  
  2.   <section itemscope itemtype=“http://data-vocabulary.org/Person”>
  3.     <img itemprop=“photo” class=“me” width=“204″ height=“250″
  4.          src=“http://diveintohtml5.org/examples/2000_05_mark.jpg”
  5.          alt=“[Mark Pilgrim, circa 2000]“/>
  6.  
  7.     <h1>Contact Information</h1>
  8.     <dl>
  9.       <dt>Name</dt>
  10.       <dd itemprop=“name”>Mark Pilgrim</dd>
  11.  
  12.       <dt>Position</dt>
  13.       <dd><span itemprop=“title”>Developer advocate</span> for
  14.           <span itemprop=“affiliation”>Google, Inc.</span></dd>
  15.  ….
  16.  

For the history, the present, and the future… give Mark’s post a good read.

Continue reading »

Tagged with:
Mar 21

Congrats to Charles Jolley and the entire team behind the SproutCore 1.0 launch. Bespin uses SproutCore now, so I am excited to see a stable build, and the hints to the future:

This project was in the works for 18 months. We rewrote 20,000 lines of code, added nearly 6,000 unit tests, and significantly improved the clarity and consistency of the API.

Most importantly, SproutCore 1.0 is a performance beast. It feels really good to be able to recommend SproutCore to people building complex app that will push the boundaries of the browser knowing that we have the goods to get them there.

If you’ve been holding off on SproutCore 1.0 until it was really really done – well it’s ready so come and get it!

Now What?

Ironically, most of the core SproutCore team has moved well along past the 1.0 candidate. A lot of work is already going into the next release with some really fantastic results. So must so that I will spend most of my talk at jsconf in April covering the new stuff instead of 1.0.

The good news is that 1.5 (or whatever it’s called) will be a much shorter release cycle – probably starting this summer. And this time a lot of the development is happening in the community so it is a lot easier for everyone to get involved.

I’ll save some of the big surprises for jsconf but suffice to say the next few versions of SproutCore will be major moves forward. 1.0 was about laying the ground work for some big things down the road. These next few releases we start to reap those rewards.

I hope to see tools and some killer mobile features in the upcoming releases :)

Continue reading »

Tagged with:
preload preload preload