Google Maps API often fails to load from China

Update 2015-01-05:

As Dan pointed out in the comments, Google has instructions for using the Maps API from China: https://developers.google.com/maps/faq#china_ws_access
I had that tested and it worked! Thanks Dan!

Update 2014-11-05:

Since about September 2014, *.google.com is completely almost completely blocked in China. This work around doesn’t apply anymore 🙁. See update above.

Original Article:

The problem

Recently I was working on Cornerstone882 website. I had the following problem: for clients located in China, Google Maps JavaScript API failed to load very often.

Moreover, the API not loading would freeze the Slideshow before its initialization, not really acceptable!

The solution

In the Google Maps JavaScript API v3 tutorial, the sample code goes like:

 

Just remove the SSL protocol to download the library using HTTP instead of HTTPS. It’s no secret that authorities here are not big fan of encryption when it is connections coming in or out of China.

So we replace:

By:

And now the map load every time without freezing the website!

4 Comments

  1. Adrian October 30, 2014 11:02 pm  Reply

    Hey Martin, we’re facing the same issue now. Does your work-around still work?

    Thanks.

    • Martin DENIZET November 5, 2014 11:10 am  Reply

      Hello Adrian,
      Sorry for the late reply.
      Unfortunately *.google.com is now completely blocked in China and it’s probably definitive 🙁 . I updated the article accordingly.
      We now need to use Google’s Chinese clone Baidu or other China-based service providers to have a map displaying correctly for China-based users.
      Cheers,

Leave a Reply