I am building a SharePoint hosted app where I am retrieving the user's location in coordinates. I am trying to reverse geocode these coordinates using google maps api. But I can't load the google maps javascript file. I tried this:


The result was it calls "successfunction" but when I try to make geocoder object inside it like this:

var geocoder = new google.maps.geocoder();

It says "google is not defined". I searched on internet in most places it is suggested that the google maps js file is not actually loaded even though javascript calls the successfunction. So I tried this also:

$.getScript( "http://maps.google.com/maps/api/js?sensor=false&callback=googleMapsLoaded");

But the function "googleMapsLoaded" is never called. I have also tried uploading the google maps js file to SharePoint style library and loading it from there but still is says "google is not defined" I am out options now. If there is any better option to reverse geocode I am open for it so please suggest. Any help is really appreciated.

1 Answer 1


Save the script(http://maps.google.com/maps/api/js) to your local and add it to scripts folder of your app solution in visual studio and load it in your default.aspx page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.