HTML and CSS Reference
In-Depth Information
the tapped content, thus making a call or sending an e-mail. In fact, many of the schemes are already whitelisted
(meaning not for duplicate use) such as
irc:
,
mailto:
,
mms:
,
news:
,
nntp:
,
sms:
,
smsto:
,
tel:
,
urn:
,
webcal:
, and
xmpp:
. There are even specific protocols for applications such as
dropbox:
,
hulu:
,
admarvel:
,
wsj:
, and
chrome:
.
The
registerProtocolHandler
method allows sites to register themselves as possible handlers for particular
schemes (or intents). For example, an online telephone messaging service could register itself as a handler of the
sms:
scheme, so that if the user clicks such a link, the user is given the opportunity to use that web site. Analogously,
the
registerContentHandler
method allows websites to register themselves as possible handlers for a content's
MIME type. For example, the same online messaging service could register itself as a handler for text/vCard files so
that if the user has no OS application capable of handling vCards, their web browser can instead suggest a site to
view the contact information. What this all means is that once again, the Web is getting very tied to normal operating
system tasks that you take advantage of daily. Instead of opening Address Book on your Mac, you can have a site
register for the vCard MIME type and choose that site/application to handle the reading of that file instead. This is
pretty cool since it's blurring the line between native OS and the Web. For more information on the Protocol API,
WebP Format
WebP is a new image format pioneered by the folks at Google after its purchase of VP8 inventor's On2 Technologies,
which provides lossless and lossy compression for images on the Web. In Chapter 7, when I discussed WebM
(a video format), you'll understand why Google developed WebP. WebP lossless images are 26 percent smaller in size
compared to their PNG counterparts and 25 to 34 percent smaller in size compared to JPEG images at equivalent
quality. WebP supports lossless transparency (also known as
alpha channel
) with just 22 percent additional bytes. For
Game Pad API
The Game Pad API is a standard in development that aims to provide universal support for game pads and joysticks
for web content. Now for the first time you can leverage the Game Pad API that reads the states of any controller
plugged into the machine via JavaScript. As you've probably guessed, this is a huge benefit for web gamers, but even
others are looking for another device to interface with web content as opposed to the traditional mouse. Because
the spec is still being worked on and adoption is only in Chrome and certain beta versions of Firefox, you can rely on
a useful JavaScript library that will handle the fragmentation between browsers, operating systems, and platforms.
The lib is called GamePad JS (
http://gamepadjs.com
)
. So, if you have an Xbox 360 controller lying around and a USB
port, give this API a whirl, but make sure you're using one of the supported browsers.
Emerging Mobile APIs
In this section, I'll focus on specific emerging mobile APIs that give you access to many device features, allowing
you to customize content more specifically for the ever-growing mobile landscape. Device support is always a
popular request by clients, who are wondering what the latest and greatest features will make their content and
advertisements really cutting-edge. The following APIs will outline some specs currently in draft or a beta use state.
Battery API
The Battery API allows for developers to query the status of the user's battery level on their mobile and portable
devices. This is really important to gain access to so you do not tax a user's device in the event they're on limited
power resources. You could offer reduced or even no ad content if the battery is at a really low level, which allows the
user to prolong the time to handle more important tasks such as making calls or e-mails. Working with the Battery