Category Archives: HTML5

Creating Websockets in JavaEE 7

I recently wrote about the WebSocket support in the latest JavaEE release i.e JavaEE 7. In the post I show how to create a WebSocket server end point and deploy it in Glassfish server and then connect to the server end point using a Javascript client end point. The complete article can be found here.

PS: I will be mostly adding my technical articles on Javabeat and all my previous articles can be found here. And I will link interesting and useful articles from this blog.

Advertisements

Book Review: Head First HTML5 Programming by Eric Freeman, Elisabeth Robson published by O’Reilly Media

We all have enjoyed reading the Head First series of books and this book i.e Head First HTML5 Programming is no different. The authors Eric Freeman and Elisabeth Robson have kept the content in the book as much practical as possible which means that your are more of coding than reading. Not all the features of HTML 5 have been covered and the few which were not covered, the authors have mentioned them in the Appendices. But the authors have covered quite a few important and tough to understand features.

HTML5 relies more on Javascript and you need not worry if you are not familiar with Javascript as the authors have good 3 chapters covering Javascript. And let me tell you even I was not well versed with Javascript when I started to read the book.

The examples explaning the video and web worker features have used complicated examples which might pose some problems for few but then those examples show the power of those features.

This book is very different from Head First HTML and CSS and the title contains the word “Programming” which is quite a clear indication that HTML5 involves programming using Javascript. And you need not worry about the CSS used in the examples of the book as they can be downloaded from the Book website.

I would recommend anyone who wants to explore HTML5 to pick this book and not get turned off by the number of pages.

Buy this book from Flipkart
Buy this book from O’Reilly site.

Getting started with JSON-P

I have during my college days used XMLHttpRequest object and its equivalent in Microsoft world to make Ajax calls and those Ajax calls were to the URL within the same domain. But with the advent of Webservices and whole lot of mashups being developed, Ajax calls are not restricted to same domain but the cut acorss different domains. When this cutting across domain boundaries happens making Ajax calls using XMLHttpRequest fails due to security enforcements implemened by the browsers. That’s when the idea of JSON-P i.e JSON with Padding came up.

In this post I will quote from different sources about JSONP and then go ahead and implement example which invokes Stackoverflow API to retrieve the unanswered questions tagged ‘jsonp’

  1. What is JSONP?
  2. Simple example for JSONP
  3. Accessing Stackoverflow API using JSONP

Continue reading

HTML5 Geolocation API with Goolge Maps

I have been reading Head First HTML5 and read about the Geolocation support in HTML5 and also went through the example they have shared about using the Google Maps with HTML5 geolocation API. It was an interesting example and I went a step further and enhanced the example to show some eat outs around the current location. For this I made use of the Places library which comes with the Google Maps API.

In this post I will cover:

  1. Getting started with HTML5 Geolocation API.
  2. Integrating Google map to show current location.
  3. Enhancing to show nearby places on Google map.

Continue reading