Passer la navigation

[Résolu] Disable Google Fonts oin Google Maps

This support ticket is created Il y a 3 years, 7 months. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Fuseau horaire du supporter : Asia/Karachi (GMT+05:00)

Ce sujet contient 2 réponses, a 2 voix.

Dernière mise à jour par jochenF-2 Il y a 3 years, 6 months.

Assisté par: Waqar.

Auteur
Publications
#2489523

I have a map loaded via toolset on my website and it injects the fonts roboto and google sans. How can i prevent the map to load them?

Best Jochen

#2491011

Hi Jochen,

Thank you for contacting us and I'd be happy to assist.

I did some research online and found this script, that prevents the fonts from Google Maps from loading:
( source: https://stackoverflow.com/a/50983518 )


(function($) {
var isGoogleFont = function (element) {
    // google font download
    if (element.href
        && element.href.indexOf('<em><u>lien caché</u></em>') === 0) {
        return true;
    }       
    return false;
}

// we override these methods only for one particular head element
// default methods for other elements are not affected
var head = $('head')[0];

var insertBefore = head.insertBefore;
head.insertBefore = function (newElement, referenceElement) {
    if (!isGoogleFont(newElement)) {
        insertBefore.call(head, newElement, referenceElement);
    }
};

var appendChild = head.appendChild;
head.appendChild = function (textNode) {
    if (!isGoogleFont($(textNode)[0])) {
        appendChild.call(head, textNode);
    }
};
})(jQuery);

It worked on my test website and you can include it in your content template's "JS editor".

regards,
Waqar

#2491033

Hi Waqar,
my issue is resolved now. Thank you!