最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Array.from() with an implementation that doesn't support iterables, Google Maps JavaScript API v3 to not work correctly

programmeradmin3浏览0评论

Google map was working and now asking require to change API key. After API key updation, it says

Array.from() with an implementation that doesn't support iterables, Google Maps JavaScript API v3 to not work correctly.

How it remove this bug?

Google map was working and now asking require to change API key. After API key updation, it says

Array.from() with an implementation that doesn't support iterables, Google Maps JavaScript API v3 to not work correctly.

How it remove this bug?

Share Improve this question edited Aug 22, 2023 at 18:50 testmap asked Aug 22, 2023 at 18:23 testmaptestmap 411 silver badge2 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 7

It's possible we have the same issue.

You probably received a mail from google which annonce an API update.

We’re writing to let you know that the Maps JavaScript API will bee unavailable to applications using non-pliant libraries, from the Maps JavaScript API version 3.54, releasing to the weekly channel in August 2023. ... Some third party libraries emulate newer JavaScript functionality, for browsers that may not support them natively. The Maps JavaScript API will start using some newer functionality in the ECMAScript standard, namely Array.from().

While Array.from() is available and working in all browsers supported by the Google Maps JavaScript API, some applications have code which replaces the working version of this with an invalid version from a library - creating an invalid JS environment. ... We have noticed that your application uses libraries inpatible with ECMAScript 2020, especially Array.from().

The first solution you can use is to specify the API version in the url. In that case, the earlier version from the update (april 2023), which is the 3.53.

It will look like that:

https://maps.googleapis./maps/api/js?key=xxxxxxxxxxxx&v=3.53

The default of this solution is that Google already announces its obsolescence:

For example, you can specify v=3.53 until April 2024, after which all Maps JavaScript versions will require a fix to your application.

Hope it will help. I will post again if I find a sustainable solution.

Axel

In my case, I had a conflict between Prototype.js and the new version of Google Maps API with the functionality Array.from().

So I have to use a local version on my website (because i usually use https://ajax.googleapis./ajax/libs/prototype), only call where is use a frame Google Maps and in that local version I change the line:

Array.from = $A;

To:

Array.from = Array.from || $A;

Hope it will help, Axel

For me it worked simply by adding the &v=3 parameter to

https://maps.googleapis./maps/api/js?sensor=true&libraries=places&key=MY_API_KEY&v=3

In your case it may work with another version depending on the environment you are working with.

It was Magento 1.9 for me

Axel's solution worked until April, after then I solved this issue by overriding Array.from following the code shown in your post's ments:

const iframe = document.createElement('iframe'); 
iframe.style.display='none'; 
document.body.appendChild(iframe); 
window.Array.from = iframe.contentWindow.Array.from; 

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论