O'Reilly logo

Programming with CodeIgniter MVC by Yehuda Zadik, Eli Orr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example 1 – HTML5 location powered by Google Maps

In this example, we will expand the Google Maps integration example from Chapter 4, Libraries, so that there will be a new option of showing the user where they are located on the Google Map. For doing so, we will use the HTML5 navigator.geolocation service to request the browsing user to share its location with the application. If the user agrees, and is using an advanced browser, such as the latest Firefox, Chrome builds that support to this service. Once we get the values, we will collect the geolocation, and call a controller method to prepare the Google Map of that area to render a Google Map view with the option navigator. We will use the HTML5 navigator.geolocation service as follows:

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required