Modified=(i want to remove css files containing fonts before they load in document, and when the document complete loading then i want to append those css files back into head so they will be ignored by google page speed insight, you can ignore the code i have written.)
i am trying to disable the fonts before they are loaded into document like removing the css file containing font faces at the document ready function, and when the document loading complete i want to append those css files back into head but the problem is i don't know. how to do this. i am trying to do this in wordpress so $ are replaced with jQuery and wordpress jquery is being used.
here is some code where i am trying to remove some css files and failing. its showing the url in consol log but not removing it. and the function to fetch css files containing font faces is out of my range. if somebody help me with it i will be really thankful.
jQuery(document).ready(function(){
jQuery('link[href]').each(function(){
let url = jQuery(this).attr('href');
if(url === "//krannaken.com/wp-content/uploads/sgf-css/font-b8f04501e2566c46133fdd3b6c616a08.css"){
console.log(url);
jQuery(this).attr('href').remove();
}
if(url === "//krannaken.com/wp-content/uploads/sgf-css/font-40569607d7578b60739e8b9717f5c0b8.css"){
jQuery(this).remove();
}
if(url === "//krannaken.com/wp-content/uploads/sgf-css/font-1b552e98c5836178863bfbc4ecd6aa9e.css"){
jQuery(this).remove();
}
if(url === "//krannaken.com/wp-content/uploads/sgf-css/font-0ae462df9c069b6a3ad293ae791fb55c.css"){
jQuery(this).remove();
}
});
});
even i am happy with if its in javascript