How can I automatically enable browser location using jQuery? Currently I can detect whether location is enabled or not from the code written below:
setInterval(function () {
navigator.geolocation.getCurrentPosition(positionFound, positionNotFound);
}, 6000);
function positionFound() {
return true;
}
function positionNotFound() {
var template = site_url + 'front/auth/setLocationFancybox';
if (!$('.fancybox-overlay').html()) {
$.fancybox.open({
padding: 0,
href: template,
type: 'iframe',
'closeBtn': false
});
}
}
In the fancybox there will be two buttons:
Turn on location: By which browser location will be turned on.Cancel: By which current parent window will get closed from the fancybox.
How can I turn on browser location and how can I close parent window from fancybox?