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
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>hidden link</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
Hi Waqar,
my issue is resolved now. Thank you!