v4.1.0
MacOS
MSSQL with IIS
I have added Google Maps in the app and these are working correctly. However, many times I get ReferenceError: Google is not defined
and TypeError: Cannot read properties of undefined (reading 'setCenter') or (reading 'setPosition')
errors from dmxAppConnect.js file and Google Maps do not load. I have also seen UTC error messages from Google.
Any help in resolving these errors is highly appreciated. I have attached a screenshot showing these errors in the console.
It seems to me that it is missing the google maps include which must be before the dmxGoogleMaps.js
include.
<script src="https://maps.googleapis.com/maps/api/js"></script>
Thanks @patrick for the quick response.
The scripts have been added in this order. The maps js script is before all the other google related scripts.
<script src="https://maps.googleapis.com/maps/api/js?key=&libraries=places" defer></script>
<script src="/dmxAppConnect/dmxGooglePlaces/dmxGooglePlaces.js" defer=""></script>
<script src="/dmxAppConnect/dmxGoogleMaps/dmxGoogleMaps.js" defer=""></script>
<script src="/dmxAppConnect/dmxGeolocation/dmxGeolocation.js" defer=""></script>
I think I have found the issue with the maps js script. Somehow, I got both async
and defer
flags set to true
for this script, which was why the script was not loading correctly sometimes. I noticed that when I copied the scripts from the app. I have removed the async
flag and it is loading correctly without any errors.
Is there a fix for the UTC error in Google Maps? I haven’t got a screenshot of this error as it has happened occasionally.
The async and defer flag both make the script loading async, difference is that defer will execute the javascript in order after dom ready and async doesn’t preserve the order, it will execute the one that was loaded first.
I don’t know about the UTC error, what exactly does it say?
That makes sense. The maps are loading correctly with defer flag in all the pages where I’m using these.
I don’t have the exact error message about the UTC, but I will take a screenshot when I see another error. I have seen it only a few times.
Thanks for your help @patrick