Support » Plugin: WP Store Locator » Google Maps API included multiple times

  • Hi there,

    it seems theme Renovate by QuanticaLabs is not compatible with this awesome plugin…

    // used in the theme:
    wp_enqueue_script("google-maps-v3", "//maps.google.com/maps/api/js", false, array(), false, true);
    
    // used in Store Locator plugin:
    wp_enqueue_script( 'wpsl-gmap', ( 'https://maps.google.com/maps/api/js' . wpsl_get_gmap_api_params() ), '', null, true );

    When commenting-out “google-maps-v3”, I cannot use Google Maps on contact pages and some dependencies are firing errors; when commenting-out “wpsl-gmap” the Store Locator does not work at all; leaving both activated, the Store Locator only shows the Search Bar (City name input and radius dropdown) and the following errors are logged to the Chrome console (Firefox seems to work fine, although the API is also included multiple times):

    Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
    You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
    You have included the Google Maps API multiple times on this page. This may cause unexpected errors.
    InvalidValueError: setCenter: not a LatLng or LatLngLiteral: in property lat: not a number
    InvalidValueError: setMap: not an instance of Map; and not an instance of StreetViewPanorama

    Maybe the reason for the errors to occur is also, that I am trying to show the Store Locator in a fancybox overlay? Would be great, if you could have a look and give a hint 🙂

    As this project is under development you have to change your hosts file and add the following lines in order to visit http://www.mobauplus.de:

    5.35.234.98	mobauplus.de
    5.35.234.98	www.mobauplus.de

    The Store Locator overlay should open up by clicking on the text next to the location icon in the very up part of the website (“……. [ändern]”).

    Thanks in advance for your help! :))

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    The store locator works fine for me in Firefox? Maybe it only happens when you are loggedin as an admin when more js scripts are loaded?

    If you still have issues with it, maybe use is_page to load the maps script from your theme only on pages where it’s actually needed.

    Thread Starter Ben

    (@benhofer)

    Hi Tijmen,

    thanks for your reply. You are right, in Firefox it works fine – but try it with Google Chrome or Safari and you’ll see the errors coming up in the Developer Tools Debug Console.

    I now rechecked everything and found out, FancyBox was not opening as iFrame but with an ajax-request (mixing up the scripts of the main page and the overlay).

    Using the “Easy FancyBox” plugin for wordpress the following settings are important:

    • Settings -> Media: “iFrame” must be activated in the FancyBox section.
    • Class “fancybox-iframe” must be used in the href tag for opening the FancyBox.

    Now everything seems to work fine.

    Best regards 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Google Maps API included multiple times’ is closed to new replies.