Chrome console warning

Hi

In the Chorome Developer Tools, a warning is displayed in the console:
“Google Maps JavaScript API has been loaded directly without loading=async.”
Is there a solution here?
Thank you very much

2 Likes

Hi there, @Osman_Guc :wave:

Apologies for the inconvenience!

Please let me check this issue with the devs. I’ll let you know once I have their response :slightly_smiling_face:

1 Like

Hi, @Osman_Guc :wave:

This isn’t actually an error, but rather a warning from the Google Maps script, recommending a different loading method. So, it doesn’t affect the widget or your website’s performance.

However, our devs will try to look into this and check if we can adjust the way the script loads. I’ll let you know as soon as I hear back :slightly_smiling_face:

1 Like

Hi @Osman_Guc :wave:

To remove this warning from the Console, please add this script next to your widget’s installation code:

<script>
  (() => {
		const filteredMessages = [
			'Google Maps JavaScript API has been loaded directly without loading=async. This can result in suboptimal performance. For best-practice loading patterns please see https://goo.gle/js-api-loading',
			'As of February 21st, 2024, google.maps.Marker is deprecated. Please use google.maps.marker.AdvancedMarkerElement instead. At this time, google.maps.Marker is not scheduled to be discontinued, but google.maps.marker.AdvancedMarkerElement is recommended over google.maps.Marker. While google.maps.Marker will continue to receive bug fixes for any major regressions, existing bugs in google.maps.Marker will not be addressed. At least 12 months notice will be given before support is discontinued. Please see https://developers.google.com/maps/deprecations for additional details and https://developers.google.com/maps/documentation/javascript/advanced-markers/migration for the migration guide.',
			`google.maps.event.addDomListener() is deprecated, use the standard
  addEventListener() method instead:
  https://developer.mozilla.org/docs/Web/API/EventTarget/addEventListener
  The feature will continue to work and there is no plan to decommission
  it.`,
		];
  
		const originalWarn = console.warn;
		console.warn = (...inputs) => {
			if (inputs.some((input) => filteredMessages.includes(input))) {
				return;
			}
  
			originalWarn(...inputs);
		};
  })();
</script>
2 Likes

Hello Max
Thank you for your Support, the warnings have now disappeared.
kind regards
Osman

2 Likes

Awesome, you’re always welcome :wink: