geo-spot-finder
is an npm package designed to help you find the user's current geolocation using their browser. It provides an easy-to-use function to retrieve latitude and longitude and display them on your webpage.
To install the package, use the following command:
npm i geo-spot-finder
To use the package with ES module syntax, import it as follows:
import geoLocation from './node_modules/geo-spot-finder/index.js';
To use the package with CommonJS syntax, require it as follows:
const geoLocation = require('./node_modules/geo-spot-finder/index.js');
Here’s a sample HTML file to demonstrate how to use the geo-spot-finder
package:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<button onclick="geoLocation()">Click to get location</button>
<h1 id="latitude">The latitude is: </h1>
<br>
<h1 id="longitude">The longitude is: </h1>
<script src="./index.js" type="module"></script>
</body>
</html>
Here’s how to include the package in your JavaScript file:
import geoLocation from './node_modules/geo-spot-finder/index.js';
geoLocation();
We welcome contributions to improve the geo-spot-finder
package! Feel free to submit pull requests or suggest enhancements. Your feedback and contributions are highly valued.
This package is licensed under the Apache License 2.0.