Geolocation for browsers
<script src="https://unpkg.com/longitude-client" charset="utf-8"></script>
$ npm install --save longitude-client
const longitude = require('longitude-client');
longitude('8.8.8.8').then(data => {
console.log(data);
// => {
// => ip: '8.8.8.8',
// => country_code: 'US',
// => country_name: 'United States',
// => latitude: 37.751,
// => longitude: -97.822,
// => ...
// => }
});
const longitude = require('longitude-client');
longitude().then(data => {
console.log(data);
// => {
// => ip: Your IP,
// => ...
// => }
});
Returns a promise with the geoip data
Type: string
The IP - Address you want to check
- longitude - Geoip for node.js
- longitude-cli - Geoip for the commandline
MIT © Tobias Herber