The Chinese (.cn) api calls .com AutocompletionService, which causes a crash

To do autocomplete in China, I referenced the Chinese Google Maps Api, as suggested in the documentation .

When he called to get the autocomplete results, I see that he is making the requests correctly: http://maps.google.cn/maps/api/js/AuthenticationService.Authenticate ? ...

... but then it goes to: https://maps.googleapis.com/maps/api/js/AutocompletionService.GetPredictions ? ...

... which cannot be completed when the website is used in China, because this domain is blocked in China.

See the plunker demo (press F12, open the Network tab, and view the prompts as you type). Apparently SO questions with plunkr links require code, so here is the script link I use:

<script type="text/javascript" src="http://maps.google.cn/maps/api/js?libraries=places&sensor=false"></script> 

Here is a screenshot that shows the problem: wrong service is called when using .cn script

Here's the bug report submitted by Google, which seems to look good to them all.

Am I doing something wrong? Can someone please confirm that they see the same behavior as me?

+6
source share

Source: https://habr.com/ru/post/982999/


All Articles