Get User Geo location in JavaScript(i.e. country,city)
![]() |
| Get User Geolocation in javascript(ie. country,city,more) |
Hi Friends Today we are Going to learn how to get user location i.e: Country,City,Region,Latitude,Longitude and Currency Symbol using JavaScript API..
Just User The below codes to get user Geo Location using JavaScript..
1. index.html
<html>
<head>
<script language="JavaScript" src="http://www.geoplugin.net/javascript.gp" type="text/javascript"></script>
</head>
<body>
<script language="Javascript">
document.write("Welcome to our visitors from "+geoplugin_city()+", "+geoplugin_countryName());
var name=geoplugin_countryName();
var city=geoplugin_city();
var region=geoplugin_regionName();
var latitude=geoplugin_latitude();
var longitude=geoplugin_longitude();
var moneysym=geoplugin_currencySymbol();
</script>
</body>
<table border="1" cellpadding="2" width="400" cellspacing="0">
<tr>
<td>Country: </td>
<td><script language="JavaScript">
document.write(name);
</script>
</td>
</tr>
<tr>
<td>City: </td>
<td><script language="JavaScript">
document.write(city);
</script>
</td>
</tr>
<tr>
<td>Region: </td>
<td><script language="JavaScript">
document.write(region);
</script>
</td>
</tr>
<tr>
<td>Latitude: </td>
<td><script language="JavaScript">
document.write(latitude);
</script>
</td>
</tr>
<tr>
<td>Longitude: </td>
<td><script language="JavaScript">
document.write(longitude);
</script>
</td>
</tr>
<tr>
<td>Currency: </td>
<td><script language="JavaScript">
document.write(moneysym);
</script>
</td>
</tr>
</table>
</html>
That's It Guys how to get user Geo location in JavaScript..
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.