JSFiddle - React, Tailwind, and code Playground
HTML
<div onclick="currentPositionTest();">
click me to test geolocation.
</div>
JavaScript
function currentPositionTest() {
var successHandler = function() {
alert(arguments.length);
};
var errorHandler = function (errorObj) {
alert(errorObj.code + ": " + errorObj.message);
};
navigator.geolocation.getCurrentPosition(
successHandler, errorHandler,
{timeout: 20000, enableHighAccuracy: true, maximumAge: 10000});
};