Fix for error in console "You have included the Google Maps API multiple times"
-
Hello! I know there is probably a better place to post this but I wanted to pop in on here to let other users know what I ended up doing to clear up the console on my site. So basically the script was referencing two different files and I looked at the version numbers and picked the higher of the two.
On my compiled wordpress page I am seeing this in the head element…
<script src="https://maps.google.com/maps/api/js?v=3.15&sensor=false" type="text/javascript"></script>
and
<script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false&ver=4.0.1"></script>
within the same page and I tracked it down to one file and it was referenced two times in that file, in the wp-google-maps plugin folder. Specifically this search string found all references that were being created in a conditional statement. This string helped me narrow the results downmaps.google.com/maps/api/js
.
ex…<script type="text/javascript"> var gmapsJsHost = (("https:" == document.location.protocol) ? "https://" : "https://"); document.write(unescape("%3Cscript src='" + gmapsJsHost + "maps.google.com/maps/api/js?<?php echo $api_version_string; ?>sensor=false' type='text/javascript'%3E%3C/script%3E")); </script>
So what I did, I just went through and commented out those references..
ex…<!--<script type="text/javascript"> var gmapsJsHost = (("https:" == document.location.protocol) ? "https://" : "https://"); document.write(unescape("%3Cscript src='" + gmapsJsHost + "maps.google.com/maps/api/js?<?php echo $api_version_string; ?>sensor=false&libraries=weather' type='text/javascript'%3E%3C/script%3E")); </script>-->
- The topic ‘Fix for error in console "You have included the Google Maps API multiple times"’ is closed to new replies.