HTML and CSS Reference
In-Depth Information
Offline Web Applications
Normally, web applications require a live connection with the server in order to function. This always-
connected behavior can create problems when the server goes offline for some reason or the network
connection is lost temporarily. The HTML5 application caching feature addresses these scenarios with the
help of the offline application caching API. Offline applications use a cache manifest file that stores a list of
files that are to be cached locally. A typical cache manifest includes a list of web pages, images, style sheets,
and script files. This way, these files are accessible even if the network connection is unavailable
temporarily. Your application can also use the offline application cache API to deal with updated versions
of pages.
File API
Traditionally, client-side code never had access to the local file system. But HTML5 allows you to read and
find information about local files. Such a feature lets you perform custom processing before a file or its
data is sent to the server. HTML5 drag-and-drop features and the file API can be used hand in hand to drag
files from the local machine onto a web page and then take further action (say, upload the file to the server
or show a thumbnail of an image file).
Web Workers
The web workers API brings multithreading to browser-based applications. Web workers essentially allow
you to load and execute JavaScript code in a separate thread without affecting the responsiveness of the
user interface. This means the end user can continue to work with the user interface while web workers
run some processing in the background. When the processing is complete, the user is notified or the page
is updated with the processing results.
Web Sockets
If you've ever programmed a desktop chat application, then you're probably aware of socket programming.
Sockets are essentially programmable interfaces that plug into each other over a network. Once they're
plugged in, the two systems can communicate with each other: client to server and server to client.
On the other hand, web pages are based on a request-response model. When a web server sends a
response to the client, it doesn't hold a constant connection with the client. So, if the server wants to notify
the client about something interesting, it doesn't have any way to do so. A popular way around this is to
periodically ping back to the server using Ajax requests. But this pull technique is still one-way
communication and isn't always efficient due to the possibility of too many requests.
Web sockets, on the other hand, provide a two-way communication channel that lets the server send
data to the client browser. They offer socket programming capabilities for web applications.
Geolocation
Geolocation has the potential to become a popular feature of HTML5 because it brings location awareness
to web applications. Using geolocation, you can develop applications that are dependent on the user's
location (assuming the device on which the page is running can report position). For example, a web site
may offer discounted rates or special offers to people living in a specific locality. In addition, geolocation
can be of great use on mobile devices such as mobile phones and tablets.
 
Search WWH ::




Custom Search