geolocation not working on safari browser,but its working fine on Chrome,IE,Mozila

I am using HTML5 geolocation which is not working on safari browser,but its working fine on Chrome,IE,Mozila,here is my current javascript code

$(function () {

$("#btnLocateMe").click(function () {
if ($("#txtLat").val() == "" || $("#txtLng").val() == "")

function show_user_location() {

navigator.geolocation.getCurrentPosition(display_user_location, error_response);
function display_user_location(user_position) {
var lat = user_position.coords.latitude;
var lon = user_position.coords.longitude;


function error_response() {
alert("Location is required to find restaurants near by you.");

How do I make it work on safari also?

Asked by:- RameshwarLate
: 4850 At:- 2/5/2018 8:32:18 AM
html5 geolocation javascript

1 Answers
profileImage Answered by:- Sam

You didn't mention Safari browser version in which code isn't working, and your website link to verify issue, you can try this 

Open System Preferences / Security and select the General tab.

Click the gold padlock icon bottom left in the pane to make any necessary changes. You will be prompted for your admin password.

If necessary, make sure: Disable Location Services is not selected. Click: Reset Warnings.Relaunch Safari. See if that made a difference.

also, please check these links which may help


According to  geolocation is supported in Safari 5.0 and above

At:- 2/5/2018 10:40:23 AM Updated at:- 2/5/2018 10:44:30 AM

Login/Register to answer
Register directly by posting answer/details

Full Name *

Email *

By posting your answer you agree on privacy policy & terms of use