Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Problems with caching of URLs containing "?" WordPress

I am the developer of [[LINK href="http://mapsmarker.com"]]mapsmarker.com[[/LINK]] & a user [[LINK href="http://wordpress.org/support/topic/leaflet-maps-marker-plugin-support-for-google-maps-as-basemaps-at-edwewocom?replies=4#post-2986156"]]got a problem[[/LINK]] with the newly added feature of Google Maps support. He receives the message "" The Google Maps API server rejected your request. The "sensor" parameter specified in the request must be set to either "true" or "false". "

I use wp_enqueue_script to load the Google Maps JS:

if ( defined('WPLANG') ) { $lang = substr(WPLANG, 0, 2); } else { $lang = 'en'; }
wp_enqueue_script( 'leafletmapsmarker-googlemaps', 'http://maps.google.com/maps/api/js?v=3.2&sensor=false&language='.$lang);


On my server, this works fine, the output in <head> is

http://maps.google.com/maps/api/js?v=3.2&sensor=false&language=en&ver=3.4.1

On the server of my user, the URL gets cut before the ?:

http://maps.google.com/maps/api/js

My user said, that as per Google's Web Page Performance Audit, resources with a "?" in the URL are not cached by most proxy caching servers.

How can I embedd the script in order to also support most proxy caching servers?
Any help is appreciated!

Answers (2)

2012-07-15

Sabby Sam answers:

Hi,
Did you find the solution from google if not then use this link

https://groups.google.com/forum/?fromgroups#!topic/google-maps-api/QoYObdWWakE

Hope this will help you.


Robert Seyfriedsberger comments:

thanks, but doesnt really help - I dont have new lines within my code...


Sabby Sam comments:

Can you paste your code or give me the url :


Robert Seyfriedsberger comments:

function lmm_frontend_enqueue_scripts() {
$plugin_version = get_option('leafletmapsmarker_version');
wp_enqueue_script( array ( 'jquery' ) );
wp_enqueue_script( 'leafletmapsmarker', LEAFLET_PLUGIN_URL . 'leaflet-dist/leaflet.js', array(), $plugin_version);
wp_localize_script ( 'leafletmapsmarker', 'leafletmapsmarker_L10n', array(
'lmm_zoom_in' => __( 'Zoom in', 'lmm' ),
'lmm_zoom_out' => __( 'Zoom out', 'lmm' )
) );
if ( defined('WPLANG') ) { $lang = substr(WPLANG, 0, 2); } else { $lang = 'en'; }
wp_enqueue_script( 'leafletmapsmarker-googlemaps', 'http://maps.google.com/maps/api/js?v=3.2&sensor=false&language='.$lang);
}


Add url: on www.mapsmarker.com it is working - my user already made a workaround, so that on EdWeWo.com it also works


Sabby Sam comments:

Hi Dear,
I didn't understand this But I can say one thing about this:

I open your header.php and on line number 58 I found this code

<blockquote><script type='text/javascript' src='http://maps.google.com/maps/api/js?v=3.2&#038;sensor=false&#038;language=en&#038;ver=3.4.1'></script>
</blockquote>

When I try open this link then I found the error as
alert("The Google Maps API server rejected your request. The \x22sensor\x22 parameter specified in the request must be set to either \x22true\x22 or \x22false\x22.")

So the conclusion is when I solve this by add modifying your script file with the below code :

<blockquote><script type='text/javascript' src='http://maps.google.com/maps/api/js?v=3.2&sensor=false&language=en&#038;ver=3.4.1></script>
</blockquote>

and it shows some code on browser.

https://github.com/egeloen/IvoryGoogleMapBundle/commit/ebfb0240331cdf0e90a4f9f16ac623889d2a3ae9


Robert Seyfriedsberger comments:

doesnt help either unfortunately


Sabby Sam comments:

It must, Solve try again, I had checked it,

Or if you give access of admin panel then It would be great for me to search error.

if yes then mail me the details
[email protected]

2012-07-18

ilabovitczeno answers:

China ropa de alta