Thursday, March 28, 2024
HomeCSSjavascript - Tips on how to get all fonts from a web...

javascript – Tips on how to get all fonts from a web page together with the src/URL of every font?


So I have to get the checklist of fonts utilized by a webpage I can not management, together with the src/URL of the font.

The easiest way I do know to get the fonts is to make use of paperwork.fonts, however I do not know methods to get the src/URL from the FontFace object returned by paperwork.fonts.

Must assist each fonts loaded from Google Font and likewise fonts loaded by consumer CSS.

I can not use this as a result of the google stylesheet is giving error Did not learn the 'cssRules' property from 'CSSStyleSheet': Can't entry guidelines due to CORS challenge.

const styleSheets = Array.from(doc.styleSheets);

styleSheets.forEach(styleSheet => {
  const cssRules = styleSheet.cssRules;
});

I am questioning if it is even attainable to do that. Thanks loads!

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments