Jump to content
thirty bees forum
  • 0

Remove Google Maps API


Manisch

Question

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?

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

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);

Link to comment
Share on other sites

  • 0

@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...

Link to comment
Share on other sites

  • 0

@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...

Link to comment
Share on other sites

  • 0

@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');

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...