Support » Plugins and Hacks » WP Google Maps » [Plugin: WP Google Maps] Patch: HTTPS Support

[Plugin: WP Google Maps] Patch: HTTPS Support

  • I noticed a small problem with your plugins when a page with a map was loaded via HTTPS in that Google complained the page had insecure items, asking whether to load them or not. Looking at your code I noticed this happens because the JavaScript is loaded directly from “http://maps.google.com/…” at wpGoogleMaps.php lines 213, 315 and 615. I attempted then manually loading it from https://maps.google.com, and it worked, so I figured a simple fix would to do the same thing Google itself does when loading Google Analytics, by changing those three lines from:

    <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>


    <script type="text/javascript">
    	var gmapsJsHost = (("https:" == document.location.protocol) ? "https://" : "http://");
    	document.write(unescape("%3Cscript src='" + gmapsJsHost + "maps.google.com/maps/api/js?sensor=false' type='text/javascript'%3E%3C/script%3E"));

    I tested this on 5.01 and it works perfectly: no more complaints from Google Chrome when loading the page from the HTTPS version!

    I hope this helps. It’d be nice to have this added to the official plugin!

    PS.: Naturally, an even simpler version would be:

    <script type="text/javascript">document.write(unescape("%3Cscript src='" + document.location.protocol + "//maps.google.com/maps/api/js?sensor=false' type='text/javascript'%3E%3C/script%3E"));</script>


Viewing 1 replies (of 1 total)
  • Plugin Author WPGMaps


    Thank you so much for this Alexander! I will implement this in v5.02 – MUCH appreciated!

    Kind regards

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: WP Google Maps] Patch: HTTPS Support’ is closed to new replies.
Skip to toolbar