How to use Geo Controller inside JavaScript?

JavaScript is enabled from version 5.2.0. In JavaScript you have 2 ways to get geo data from our plugin, using `cf.geoplugin` or `window.cfgeo` objects. This 2 objects contain all geo informations from our plugin and is available inside public and admin area.

<script>
// Look in your console for all available objects
console.log(window.cfgeo);

// you can use this everywhere you want
var city = window.cfgeo.city,
    state = window.cfgeo.state,
    country = window.cfgeo.country,
    ip = window.cfgeo.ip;
</script>

About the author

Login

Lost your password? Register

Register

Your personal data will be used to support your experience throughout this website, to manage access to your account, and for other purposes described in our privacy policy.

Lost your password? Login