How do i get User IP Address, Latitude, Longitude, Country, City, State Details


To get current user location details

Please copy below code.

<script src="" type="text/javascript"></script>
<script type="text/javascript">
var strip, strcountry, strcity, strregion, strlatitude, strlongitude, strtimezone

function GetUserInfo(data) {
	strip =; strcountry = data.countryName; strcity =;
	strregion = data.region; strlatitude = data.latitude; strlongitude = data.longitude;
	strtimezone = data.timezone;
$(function () {
function BindUserInfo() {
	document.getElementById('lblIP').innerHTML = strip;
	document.getElementById('lblCountry').innerHTML = strcountry;
	document.getElementById('lblCity').innerHTML = strcity;
	document.getElementById('lblregion').innerHTML = strregion;
	document.getElementById('lbllatitude').innerHTML = strlatitude;
	document.getElementById('lbllongitude').innerHTML = strlongitude;
	document.getElementById('lbltimezone').innerHTML = strtimezone;
<script type="text/javascript" src=""></script>

Below is a HTML

<table id="tbDetails" cellpadding="2" cellspacing="2" style=" border:1px solid #000; font-family:Verdana;" >
	<tr style="background-color:#C; color:White; font-weight:bold">
		<td colspan="2" align="center">User Information</td>
	<tr style="border:solid 1px #000000">
		<td align="right">IP:</td>
		<td><label id="lblIP"/></td>
		<td align="right">Country:</td>
		<td><label id="lblCountry"/></td>
		<td align="right">City:</td>
		<td><label id="lblCity"/></td>
		<td align="right">Region:</td>
		<td><label id="lblregion"/></td>
		<td align="right">latitude:</td>
		<td><label id="lbllatitude"/></td>
		<td align="right">Longitude:</td>
		<td><label id="lbllongitude"/></td>
		<td align="right">Time Zone:</td>
		<td><label id="lbltimezone"/></td>

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

2 thoughts on “How do i get User IP Address, Latitude, Longitude, Country, City, State Details

  1. User Information
    IP: undefined
    Country: undefined
    City: undefined
    Region: undefined
    latitude: undefined
    Longitude: undefined
    Time Zone: undefind.
    This is what i get

    • Yes. you are right..

      Sorry for that.

      Its depend upon third party javascript.

      Right now we have no more access of “”

      that is why its not working. 😦


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s