IP Address Detection Using jQuery

The code below can be used to detect an IP address from within a device's DOM (Document Object Model) using jQuery.

Create a free access point to receive your unique key and code

<!-- jQuery library URL path -->

<script type="text/javascript">

// KickFire IP Detection Endpoint
$(document).ready(function() {
     $.getJSON('//api.kickfire.com/ip',{ipkey:'xxxxxx'},function(ip) {


What is a DOM?

The Document Object Model (DOM) is the programming interface that for HTML, XHTML, or XML documents.
Simply put, it connects web pages to programming languages or scripts.

A web page is simply a document that can be viewed in the browser window or as HTML source code. The DOM provides another representation of the same document and defines ways that programs can access the document to store or manipulate the content, style or structure.

How else can I detect an IP address?

Detecting an IP address through server-side language such as PHP, Java, etc. is the best practice. There are many examples using Remote-Addr and X-Forwarded-For that can be found with a quick Google search.

// PHP example to detect IP address

if (!empty($_SERVER["HTTP_CLIENT_IP"])) {

     // Check for ip from share internet
     $ip = $_SERVER["HTTP_CLIENT_IP"];
elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {

     // Check for the Proxy User
else {

     // Couldn't find anything so go with this
     $ip = $_SERVER["REMOTE_ADDR"];
What else does KickFire offer?

KickFire is the leader in IP address intelligence, company identification technology and cloud-based B2B sales automation. The KickFire solutions are powered by TWIN Caching, an advanced, proprietary IP-to-company identification technology.

  • KickFire API uses proprietary IP address intelligence to power applications such as account-based marketing, content personalization, predictive, intent, B2B ad-targeting, and much more.
      Available KickFire API Endpoints:
    • IP2Company - "Translate an IP address to domain and include company firmographics such as, company name, industry, revenue, location, etc."
    • Domain2IP - "Uncover the IP addresses owned/used by this domain"
  • KickFire LIVE Leads taps into your company's invisible pipeline by identifying anonymous web visitors showing buying intent for your products and services, in real-time!
  • KickFire Prospector is a free, powerful Chrome extension designed to find leads, get verified contact information, and push new accounts into your CRM - all without having to leave a website.