6

I'm currently working on a platform that will be launched all over the world and I am working in Shanghai China and as you might know there is a very big Firewall policy here.

The site contains a custom map view created with the Google Maps API this is because Google allows a lot of nice features to change the look and feel of the map.

But now I'm running into a problem where if a user wants to access the site without VPN the whole page where the map is located slows down,crashes and breaks my login procedure.

Here are the errors showing in the Console View:

GET https://maps.googleapis.com/maps/api/js?key=1010101010101&sensor=true net::ERR_CONNECTION_TIMED_OUT

Uncaught ReferenceError: google is not defined

I want to know if there is a way to check if I have a connection to the Google Maps API before executing the code?

Cheers,

Koen

Koen H
  • 111
  • 2
  • 8
  • 1
    possible duplicate of [How to check if Google Maps API is loaded?](http://stackoverflow.com/questions/9228958/how-to-check-if-google-maps-api-is-loaded) – Keith Sep 04 '15 at 01:48
  • would suggest you do a full try catch in your case. – RGAT Sep 05 '15 at 06:43

1 Answers1

1

Checking if the API is loaded, as Keith links above, is a good way to see if the loading has had any trouble.

To minimize problems loading the API in China the Maps API FAQ recommends loading the API from http://maps.google.cn/maps/api/js and not using https.

bamnet
  • 2,398
  • 13
  • 20