HTML and CSS Reference
In-Depth Information
provide support or develop such a feature from scratch, it's easy to consume the native support provided
by HTML5. For example, ASP.NET developers used validation controls or custom validation libraries to
validate user input. But HTML5 natively supports many of the commonly needed validations. Thus
HTML5 is an umbrella that covers markup tag, markup standards, programmable APIs, and new JavaScript
The subsequent chapters of this topic dissect the HTML5 APIs and associated JavaScript objects one
by one. This section's overview of these programmable features gives you an idea of what's coming.
Audio and Video
Playing audio and video files used to be tricky and often involved dependency on third-party plug-ins such
as Flash and Silverlight. HTML5 introduces <audio> and <video> elements so a web page can play media
files with ease. This native support means that playing media files requires no special plug-ins, applets, or
ActiveX controls. HTML5 also provides audio and video APIs to control various aspects of the audio and
videos being played. This programmability gives you better control over the media files and how to play
One of the reasons for the popularity of the Web is the GUI offered to end users: images, animations, fonts,
and other interactive effects make a web site appealing from an end user's perspective. However, web
developers often encounter limitations when drawing graphics in the browser. Developers commonly use
Flash or Silverlight plug-ins to generate graphics on the server side and then send them to the client
browser as pictures.
HTML5 does a great job in client-side graphic rendering by offering the <canvas> element. You do your
actual drawing using the canvas API. Some of the areas in which the canvas API can be useful include
charting, gaming, and online drawing tools.
History API
Before the advent of HTML5, web developers had little control over session history and its manipulation.
The HTML5 history API provides a means to perform tasks such as moving forward and backward in the
session history, adding new entries to the history, and synchronizing page content when the user navigates
within the history. The history API is a standardized way to manipulate the browser history via JavaScript
and is especially useful in Ajax-driven applications that have no one-to-one mapping between the page
URL and the content being displayed at a given point in time.
Web Storage
As an ASP.NET developer, you may have used cookies to store small pieces of data on the client side. One
limitation of using cookies is the amount of data that can be saved. For example, many browsers limit each
cookie to 4,096 bytes.
HTML5 web storage allows you to store more data on the client side using JavaScript code. Web
storage comes in two flavors: local storage and session storage. Local storage is persisted on the client
machine across browser sessions, whereas session storage is persisted only for the current session. These
storages are exposed as two new JavaScript objects: localStorage and sessionStorage .
Search WWH ::

Custom Search