• Resolved linux4me2

    (@linux4me2)


    I’ve noticed that with the latest version of the plugin, version 3.19.0, there is a warning in Firefox Console that says:

    Google Maps JavaScript API has been loaded directly without a callback. This is not supported and can lead to race conditions and suboptimal performance. For supported loading patterns please see https://goo.gle/js-api-loading js:229:52

    The reference links to this page.

    Race conditions and suboptimal performance are things I would like to avoid. This sounds like something that will have to be fixed by the developers in an update, correct?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Jordan Torres

    (@jordantorres)

    This is a map loading tag. Are you using our IDX with your Google maps key and using that same key on your theme? This could be causing the key to be loading in twice and calling the Google Maps twice on our plugin.

    Thread Starter linux4me2

    (@linux4me2)

    Hi @jordantorres,

    Thanks for the reply. Yes, I am using your IDX with a new Google Maps API key, but don’t use Google Maps anywhere else and there is no other entry for the maps API key. The theme does not load Google Maps, or use the API key. It’s a default WP theme.

    I am using the plugin’s Current Listings widget on every page, so I checked a page that doesn’t use any IDX elements in the main content area to see if that was causing the warning, but it still occurred on pages with only the widget.

    I’ve tried the usual: purging the browser and server cache, but the warning persists. I’m not getting the error that Firefox shows when Google Maps loads twice, just the warning noted in the original post.

    Plugin Support Jordan Torres

    (@jordantorres)

    Are you able to send us the page to your website and we can then check the console for this warning. Send that over to [email protected]. I do see something here on stack overflow with this fix: https://stackoverflow.com/questions/75179573/how-to-fix-loading-the-google-maps-javascript-api-without-a-callback-is-not-sup

    Thread Starter linux4me2

    (@linux4me2)

    I just sent the URL to the site.

    That Stack link is promising.

    Thread Starter linux4me2

    (@linux4me2)

    Diverse Solutions’ Tech Support is forwarding the issue to their developers, but they aren’t sure if there will be a fix released since the issue is a warning and not an error.

    A fix that works for me, based on the Slack post that @jordantorres posted above, is to change line 32 of /wp-content/plugins/dsidxpress/globals.php from this:

    wp_enqueue_script('dsidxpress_google_maps_geocode_api', '//maps.googleapis.com/maps/api/js?key='.DSIDXPRESS_GOOGLEMAP_API_KEY.'&libraries=drawing,geometry');

    to this:

    wp_enqueue_script('dsidxpress_google_maps_geocode_api', '//maps.googleapis.com/maps/api/js?key='.DSIDXPRESS_GOOGLEMAP_API_KEY.'&libraries=drawing,geometry&callback=Function.prototype');

    I applied the fix to the site, the warning is gone, and Google Maps is still working.

    Note that due to the conditional in the globals.php file, you’ll have to have your own, active, Google Maps API Key saved in IDX > More Options > Maps > Google Maps API Key in order for the variable that adds the callback to be added to the query string.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Google Maps JavaScript API Has Been Loaded Directly Without a Callback’ is closed to new replies.