Can we not load CSS and JS on non-map pages?

Is there a way to not load google_maps_user.css and google_maps_loader.js on every page of my site?

  • Mason

    Hiya,

    As we haven't heard back from you we're going to assume the problem
    was sorted out and mark this ticket as resolved.

    If it wasn't resolved, or you have any more questions related to this
    thread please feel free to post them below and tick the 'Mark as Not
    Resolved (re-open)' box below the post area (or else we'll miss it!)

    Otherwise, thanks for using the forums, and for being a member of WPMU
    DEV, it's a pleasure to help you out and we look forward to being of
    assistance in the future.

    Thanks!

  • thoncs

    Um, nope. Every page of my every one of my sites that uses the maps plugin loads

    <link rel='stylesheet' id='agm_google_maps_user_style-css'  href='http://leaucal.com/wp-content/plugins/wpmu_dev_maps_plugin/css/google_maps_user.css?ver=3.2.1' type='text/css' media='all' />
    <script type="text/javascript">if (typeof(_agmMaps) == "undefined") _agmMaps = [];</script><script type="text/javascript">var _agm_root_url="http://leaucal.com/wp-content/plugins/wpmu_dev_maps_plugin"; var _agm_ajax_url="http://leaucal.com/wp-admin/admin-ajax.php"</script><script type='text/javascript' src='http://leaucal.com/wp-includes/js/l10n.js?ver=20101110'></script>
    <script type='text/javascript' src='http://leaucal.com/wp-includes/js/jquery/jquery.js?ver=1.6.1'></script>
    <script type='text/javascript' src='http://leaucal.com/wp-admin/js/utils.js?ver=20101110'></script>
    <script type='text/javascript' src='http://leaucal.com/wp-content/plugins/wpmu_dev_maps_plugin/js/google_maps_loader.js?ver=3.2.1'></script>
    <script type='text/javascript'>
    /* <![CDATA[ */
    var l10nStrings = {
    	close: "Close",
    	get_directions: "Get Directions",
    	geocoding_error: "There was an error geocoding your location. Check the address and try again",
    	missing_waypoint: "Please, enter values for both point A and point B",
    	directions: "Directions",
    	posts: "Posts",
    	showAll: "Show All",
    	hide: "Hide",
    	oops_no_directions: "Oops, we couldn\'t calculate the directions"
    };
    /* ]]> */
    </script>
    <script type='text/javascript' src='http://leaucal.com/wp-content/plugins/wpmu_dev_maps_plugin/js/google_maps_user.js?ver=3.2.1'></script>

    You'll notice it actually loads google_maps_user.js twice. This is from version 2.0.4.1 on a page without an embedded map. This is the case regardless of the theme in use.

  • Vladislav

    Hi,

    Embedding a created map in your post is just one way in which the map can appear in your page. There are a lot of other ways in which this can happen (widgets, autocreated maps, dynamic maps, add-ons, template tag) with a lot of edge cases, so including them on public pages is the safe choice. Also, if you look closely at the embedded URLs, you'll notice that the scripts aren't actually included twice.

    However, SSL compatibility is an excellent point. This issue should be fixed with the latest plugin release (v2.4.1, just released).

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.