Get User Geo location in JavaScript using google map api---codenair.com - Web Development and Web Design Codes

Latest

Thursday, February 15, 2018

Get User Geo location in JavaScript using google map api---codenair.com

Get User Geo location on G Maps using JavaScript and google map API..

Hi Friends Today we are Going to learn how how to get user Geo Location in Google Maps using Google Maps JavaScript API..
Get User Geo location in JavaScript using google map api---codenair.com
Get User Geo location in JavaScript using google map api---codenair.com
First You Need a Key to Access Google Maps API..
Look below Step to Get Google Maps API key..
1.. Go to : https://developers.google.com/maps/documentation/javascript/get-api-key 
2. Click on "GET A KEY"
Get User Geo location in JavaScript using google map api---codenair.com
3. After That's a pop up windows will appear.now write your project name and click on next..like below
Get User Geo location in JavaScript using google map api---codenair.com
4. wait and get your Google map JavaScript API key..like below 
Now Use the above codes to access google map API using JavaScript..

Codes to Access Google Maps..
1. index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<html>
 <head>
 <title>Get User Geo location in JavaScript using google map api---codenair.com</title>
  <script src="http://maps.google.com/maps?file=api&v=2&key=Your API Key Here" type="text/javascript"></script>
  <script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
  
  <script type="text/javascript">
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.addControl(new GLargeMapControl());
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(geoplugin_latitude(), geoplugin_longitude()), 12);
      }
    }
  </script>
 </head>
 <h2>Geo location in JavaScript using google maps api---codenair.com</h2>
 <body>
   <div id="map" style="width: 500px; height: 300px"></div>
   <script>load();</script>
 </body>
</html>

That's it Guys how to get google maps JavaScript API and access google maps..
keep visiting ..Thank You..

No comments:

Post a Comment

Thank You for Your Comment

Note: Only a member of this blog may post a comment.