Geecon – HTML5 for Java Developers
This lecture has been taken by very interesting and passionate guy – Sang Shin. He has briefly mentioned and demonstrated some key features of HTML5 which are relevant for Java developers. Let’s take a short tour through the list…
In today’s world of mobile devices our web applications could take advantage of user’s location data which can be read from system. HTML5 introduces simple API for accessing geolocation information.
By calling getCurrentPosition() method you can get latitude and longitude data. User have to allow web page to access geolocation data otherwise error occures. By checking error code we can display relevant message to user.
Once guy permits or forbade accessing these data, his decision is cached for given domain. Guy should clean cached decisions to change it.
For more information check http://www.w3schools.com/html/html5_geolocation.asp
So far it’s been a little bit complicated to embed a video or audio content into your web page. Usually you have to use flashplayer or other plugins and embed video player into html. HTML5 ambition is to make including media as simple as including pictures. For this purposes new tags were created – video tag (http://www.w3schools.com/html/html_videos.asp) and audio tag (http://www.w3schools.com/html/html_sounds.asp).
You can specify various video formats and browser could choose supported one. You can also add subtitles track to video.
Very interesting feature of the HTML5 is offline storage. You can store some data for your application in browser. These data could be used when internet connection is not working for example.
There are 2 possibilities for storing data:
- storing data for session (data is lost when tab is closed)
o window.localStorage object
- storing data for application (no expiration date)
o code.sessionStorage object
More information you can find here: http://www.w3schools.com/html/html5_webstorage.asp
Server Side Events (SSE)
SSE is one way messaging method (from server to client). There’s no need to check server for updates anymore. Your web page could wait for notification and only after that would perform appropriate action.
Posted in programming