msblogs

technology news @fingertips
  • Home
  • About

Same Markup: Using , , and

No comments September 3rd, 2010 admin

On this blog we’ve repeatedly discussed enabling the “Same Markup” for Internet Explorer 9. Part of making “Same Markup” a reality involves supporting the right features in IE9 to make the same HTML, JavaScript, and CSS “just work” the same way they do in other browsers. Part of how IE9 contributes to enabling the “Same Markup” is through support for the <canvas>, <audio>, and <video> elements from HTML5. These were introduced in the third platform preview and continue to be improved with each update.

In my first post on “Same Markup”, I described the effort as an “n-way street”. Each browser has a part to play by supporting the right features with the right behavior. Web developers also have a part to play in how they code for cross-browser differences where they unfortunately still exist. The most important part of working across browsers for web developers is to detect features, not browsers. So in this post I’ll outline how to use feature detection for <canvas>, <audio>, and <video>.

Detecting Support from HTML Markup

Unlike other features, support for <canvas>, <audio>, and <video> can be detected directly from HTML markup. This involves simply using the desired element, then placing fallback content inside of it intended for browsers that don’t have support for these elements. Browsers with support will hide this content from the user and display only the <canvas>, <audio>, or <video> element itself.

<!-- Example 1: Basic <canvas> fallback -->
<canvas>
	This text only displays in browsers without canvas support.
</canvas>
<!-- Example 2: Basic <audio> fallback -->
<audio>
	This text only displays in browsers without audio support.
</audio>
<!-- Example 3: Basic <video> fallback -->
<video>
	This text only displays in browsers without video support.
</video>

One caveat to keep in mind is that fallback content is only hidden visually. <script> blocks and other items in fallback content will always execute, even in browsers that support these elements.

<!-- Example 4: <script> always executes in fallback content -->
<canvas>
	<script>
		alert("This always runs, even when canvas is supported.");
	</script>
</canvas>

Of course, fallback content should also be useful. Exactly what qualifies as useful can vary depending on what you are trying to do. One approach is to point the user at a download for an upgrade, but in most cases it is a better experience for consumers to fall back to alternative approaches for delivering the content. For example, if you’re drawing something that doesn’t change much to a canvas, you may be able to fall back to an image that gets generated server-side. A better alternative could involve including a framework which implements canvas on top of existing web technologies or using a widely deployed plug-in.

The <audio> and <video> elements tend to have more options for fallback via plug-ins, whether through a media player or an app built on top of a widely deployed technology such as Flash or Silverlight. At the very least you can provide the user with a link to download the file so they can play it locally. The examples below provide a rough view of this type of fallback, though the <object> tag generally requires a number of varying parameters specific to the chosen plug-in.

<!-- Example 5: Provide useful fallback content for <audio> -->
<audio src="myaudio">
	<object type="audio-plugin-mime-type" data="myaudio">
		<a href="myaudio">Download the audio file</a>
	</object>
</audio>
<!-- Example 6: Provide useful fallback content for <video> -->
<video src="myvideo">
	<object type="video-plugin-mime-type" data="myvideo">
		<a href="myvideo">Download the video file</a>
	</object>
</video>

Detecting Support from Script

In addition to HTML markup, support for <canvas>, <audio>, and <video> can also be detected from script. This detection can be performed many ways, but one of the simplest is to check for the existence of the appropriate interface object off of window.

// Example 7: Simple feature detection for <canvas>
if(window.HTMLCanvasElement) {
	// Code requiring canvas support
}
// Example 8: Simple feature detection for <audio>
if(window.HTMLAudioElement) {
	// Code requiring audio support
}
// Example 9: Simple feature detection for <video>
if(window.HTMLVideoElement) {
	// Code requiring video support
}

An alternative approach for detecting <audio> and <video> involves checking for the existence of the canPlayType method on a dynamically created <audio> or <video> element. This is used by a number of frameworks and is generally preferred if you also intend to use the canPlayType method to test for supported codecs (which will be covered in a future post). If you simply need to test whether <audio> or <video> is supported, then I find the approach outlined above in examples 8 and 9 to be more obvious and equally as effective.

// Example 10: Alternate feature detection for <audio>
if(document.createElement("audio").canPlayType) {
	// Code requiring audio support
}
// Example 11: Alternate feature detection for <video>
if(document.createElement("video").canPlayType) {
	// Code requiring video support
}

A similar alternative approach can be used for detecting <canvas> support. In this case, most frameworks have settled on checking for the existence of the getContext method. This makes sense for <canvas> given that this method is required in order to retrieve a context for rendering.

// Example 12: Alternate feature detection for <canvas>
if(document.createElement("canvas").getContext) {
	// Code requiring canvas support
}

Next Steps

If you have previously used browser detection to decide whether to use <canvas>, <audio>, or <video>, now is the time to update to use feature detection instead. Also, make sure you have a DOCTYPE at the top of your page (e.g. <!DOCTYPE html>) so your content doesn’t render in Quirks Mode. In IE9, Quirks Mode is used for compatibility and consequently the <canvas>, <audio>, and <video> elements will not work there.

Stay tuned for future posts covering how to detect supported codecs and specify multiple sources using the <audio> and <video> elements.

Tony Ross
Program Manager

Edit 9/3 – added link to earlier blog post in second paragraph


IEBlog

Uncategorized Markup, same, Using

Is Flash on Android “Shockingly Bad” or “Shockingly Great?”

No comments September 3rd, 2010 admin

After posting Kevin Tofel’s demo of the struggles he had with Flash-based video on his Nexus One mobile handset, we’ve received a ton of comments, including response videos from readers who showed their own experiences with Flash on Android mobile handsets. Here are just a few.


Alcatel-Lucent NextGen Communications Spotlight — Learn More »


GigaOM

Google Android, Bad”, Flash, Great”, “Shockingly

Duke Nukem Forever…coming soon?

No comments September 3rd, 2010 admin

Duke Nukem Forever has been in an on again off again state for quite a while now. It’s like a bad relationship you just can’t walk away from. Duke Nukem Forever is supposed to be the sequel to the hit game, Duke Nukem 3D. Development started on Duke Nukem Forever…




Neowin.net

Internet Explorer Duke, Forever...coming, Nukem, soon

Add-ons, Installation Experiences, and User Consent

No comments September 3rd, 2010 admin

As discussed in previous blog posts, add-ons can have a material impact on browser performance. IE measures the performance of add-ons so that users can make informed decisions about them. It is important to understand how add-ons arrive on a user’s system to begin with because browser performance is so important to site developers and to consumers. The notification and control that users have around the add-on installation process is equally important because add-ons can also have an impact on user privacy and information sharing. This blog post surveys the current installation experience for different kinds of add-ons in different browsers and how the add-on installation experience can be more robust for consumers.

First, let’s look at mark-up based add-ons in IE. These add-ons describe their functionality without any executable code, typically using XML. Examples are OpenSearch providers, Web Slices, and Accelerators. There is no code in the add-on itself and no code involved when the add-on is installed. Consumers install these add-ons from within the browser. There is clear consumer consent as part of that in-browser installation experience:

Accelerator installation consent dialog from IE8

Binary add-ons, like Toolbars and BHOs, are full Windows programs that run within the browser. The installers for these Windows programs are other Windows programs that run outside the browser. Some add-on installations are the result of a user explicitly seeking them out and installing them. Other add-on installations are bundled with other software. These can be a surprise to users, and are often installed without explicit consent.  Technically, browsers can only detect that an add-on was installed, not what consent the user gave during installation. We hope you’ll share your favorite examples of software installation surprises in the comments. It is not clear from within the browser what consent (if any) a consumer has given when one of these add-ons is installed. It is clear that the next time the user starts IE, the new add-ons will affect browser performance and reliability, and possibly privacy.

Add-ons can also affect privacy. Additional code running in the browser can send user information to websites. (You can read more about an add-on that sent user information inappropriately here.) For this reason, when users start IE8’s InPrivate Browsing feature, IE runs without toolbars and BHOs. The user expects an InPrivate session to be private, and there is no way for IE to know what information add-ons save on the user’s system or send to websites. 

Because many add-on setup experiences surprise users, some browsers today seek user conformation before they run newly installed add-ons. For example, here’s the dialog that Firefox 3.6 shows the first time the user starts it after installing an add-on:

Firefox add-on installation consent dialog

Note that before seeing this prompt, the user initiated the add-on installation explicitly and clicked two prompts within the browser to install the add-on.

On today’s web, consumers face many different threats to browser security, reliability, performance, and privacy. We work closely with other software vendors to make experiences within IE better for consumers. For example, we exchange feedback with toolbar vendors about their work and the IE Add-on Guidelines and Requirements. Many times, these conversations result in improvements to add-ons. Microsoft treats all add-ons and software vendors consistently with respect to these guidelines and requirements. Given the ambiguities and risks around add-ons, consumers benefit from having more information and more control over how add-ons are installed.

Herman Ng

Program Manager, Internet Explorer


IEBlog

Uncategorized Addons, Consent, Experiences, Installation, user

Facebook Ramping Up the Social in Its Search Engine

No comments September 3rd, 2010 admin

As expected, Facebook has started integrating social activity from around the web into the search results on its site, by showing how many people “liked” or shared a specific news story or blog post, as shown in the screenshot below (first noticed by All Facebook). The results are powered by the social-graph plugins embedded in hundreds of thousands of websites, which Facebook launched earlier this year at its F8 conference. The new feature is the latest step in rolling out the network’s social-search engine — which could become a competitive threat for Google and other traditional search companies, as more users turn to recommendations from their networks instead of those determined by algorithms.

Related content from GigaOM Pro (sub req’d): Why Google Should Fear the Social Web



Alcatel-Lucent NextGen Communications Spotlight — Learn More »


GigaOM

Google engine, Facebook, Ramping, search, Social
Older Entries
Twitter Delicious ASP on Facebook Digg Stumbleupon Favorites More

Random Posts

  • Google Winning Sign-In War, But Facebook Close Behind
  • Google-Verizon: It’s all about the Money
  • Twitter Wants to Tell You a Story With Twitter Tales
  • IE’s Compatibility Features for Site Developers
  • Windows Live Sync could be your one-stop-shop in the cloud

Recent Comments

Categories

  • Apple
  • Dell
  • Gaming
  • Google
  • Hp
  • Intel
  • Internet
  • Internet Browser Software
  • Internet Explorer
  • Internet Explorer 8
  • Internet Speed Test
  • Iphone
  • Mac
  • Microsoft
  • Mobile
  • Server
  • Technology
  • Uncategorized

Archives

  • September 2010
  • August 2010
  • July 2010

Tag Cloud

2010 2011 About Android apple Apps available Beta Bing Chrome Cloud coming Facebook First from Future Games Gets Gmail Google Hotmail Intel Internet iPad iPhone launches Live Market Media Microsoft mobile more Office Online Phone Reviews search Social this Twitter updated Verizon Video Windows Xbox

Links

  • Support Forum
  • Plugins
  • Suggest Ideas
  • WordPress Blog
  • Themes
  • WordPress Planet
  • Documentation
Top wordpress
Copyright © 2010 msblogs
Theme by yinheli. Valid XHTML 1.1 and CSS 3.