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…
Geolocation
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
Media
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.
By the way media becomes part of the DOM, so you can simply access it and control it by JavaScript.
Offline storage
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
Web Workers
Have you ever seen web page which becomes unresponsive because of heavy JavaScript load? You sure do
For such a cases web workers had been invented. A web worker is JavaScript which runs on the background. Your application is still responsive and user can continue working with it while code is working.
More info: http://www.w3schools.com/html/html5_webworkers.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.
More info: http://www.w3schools.com/html/html5_serversentevents.asp
Drag’n’Drop
Drag and Drop has become a part of the standard. You do not need to use JavaScript frameworks such as jQuery. Browsers should support Drag and Drop functionality out of the box.
See: http://www.w3schools.com/html/html5_draganddrop.asp
Posted in programming
Leave a Reply