Manisch Posted February 15, 2018 Posted February 15, 2018 Hello there, I'm just trying to optimize the speed of my page a little and most complains gtmetrix has come from the Google Maps api. Since I'm not using any map (front + backoffice), I want to simply remove the whole api. But...how? Can anyone tell me where the maps api is located?
0 romaric17 Posted February 15, 2018 Posted February 15, 2018 Hello My Thirtybees front doesn't load any Google Maps API. I think you have to disable any module that could load the Google Maps API or may be check if it's your theme that loads it.
0 Manisch Posted February 15, 2018 Author Posted February 15, 2018 Hmm, is there a way to trace it back? I can't see a module that seems obvious. But perhaps I just ask the template-support.
0 Manisch Posted February 15, 2018 Author Posted February 15, 2018 Ah ok, it actually was a module - in my case TM Mega Menu. I just edited the file modules > tmmegamenu > tmmegamenu.php Somewhere there (line ~2679) are two lines like this '://maps.google.com/maps/api/js?region='.Tools::substr($defaultcountry->isocode, 0, 2); I just removed the first part so it looks like this: :''.Tools::substr($defaultcountry->isocode, 0, 2);
0 datakick Posted February 15, 2018 Posted February 15, 2018 @manisch that's not a good solution. This will probably create script tag in your page like this: <script type="text/javascript" src='httpen' /> that will result in http request to your domain, ie: http://www.domain.com/httpen. Request will return 404 not found, and you'll get error code in your console. Immediately after that you will find another couple of errors related to missing google maps library, because javascript code that utilize this library is still present...
0 Manisch Posted February 15, 2018 Author Posted February 15, 2018 @datakick hmm, right now everything seems fine. What would you suggest?
0 datakick Posted February 15, 2018 Posted February 15, 2018 @Manisch I would need to see source code of the module. But I believe that the line you've mentioned starts with something like this: $this->context->controller->addJS(.... You will want to remove the whole line. Next, search for text 'google.maps' in *.js files of this module... and get rid of all references to google maps api... somehow...
0 Manisch Posted February 15, 2018 Author Posted February 15, 2018 @datakick it might seem a little dirty, but I was just glad it works without error so far :D But it actually looks like this (XXX marks where once was the url) $google_script = 'http'.((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 's' : '').'XXX'.Tools::substr($default_country->iso_code, 0, 2); $entry = strpos(implode(',', $this->context->controller->js_files), $google_part); and $this->context->controller->addJS('http'.((Configuration::get('PS_SSL_ENABLED') && Configuration::get('PS_SSL_ENABLED_EVERYWHERE')) ? 's' : '').'XXX'.Tools::substr($default_country->iso_code, 0, 2)); $this->context->controller->addJS($this->_path.'views/js/admin.js');
Question
Manisch
Hello there,
I'm just trying to optimize the speed of my page a little and most complains gtmetrix has come from the Google Maps api.
Since I'm not using any map (front + backoffice), I want to simply remove the whole api. But...how?
Can anyone tell me where the maps api is located?
7 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now