A guide to troubleshooting the "Missing Font" error caused by a Chrome Extension in Google Chrome

Summary: Can I see the list of fonts available on a website using Chrome?

As a Chrome OS user, I am unable to install custom fonts on my system.

To overcome this limitation, I developed a Chrome extension that adds the fonts I desire to web pages:

  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"], 
      "css" : ["fonts.css"]
    }
  ],
  "web_accessible_resources": [
    {
        "resources": ["fonts/*.ttf", "fonts/*.woff2"],
        "matches": ["http://*/*", "https://*/*"]
    }
  ]

The CSS file simply sets the font-face property:

@font-face {
  font-family: 'Hack';
  src: url('chrome-extension://__MSG_@@extension_id__/fonts/hack-regular.woff2');
  font-weight: 400;
  font-style: normal;
}

code { font-family: 'Hack', monospace !important; }
pre { font-family: 'Hack', monospace !important; }
:root { --monospace-font-family: 'Hack'; }

The final CSS rules might not be relevant in this context.

While this solution has been effective for websites like vscode-remote where I can choose the font from settings, I encountered an internal site within my company that does not allow this customization.

Although the computed CSS specifies my desired font, it seems to be inaccessible:

font-family: Hack, "Comic Sans MS", monospace;

I noticed that the CSS rules are being applied by an "injected stylesheet" (which I cannot debug as it originates from an extension).

In essence, my font works on other websites and my CSS is in place, so why is it not loading correctly?.

I examined the network tab and observed that the font is not being downloaded (unlike on other sites).

Answer №1

It appears that installing the font on all frames is necessary.

The revised version of manifest.json:

  "content_scripts": [
    {
      "matches": ["http://*/*", "https://*/*"], 
      "all_frames": true,
      "css" : ["fonts.css"]
    }
  ],

A colleague pointed out the issue, and I confirmed it while attempting to utilize a font added to a parent iframe instead of the one I needed.

Regarding "How to debug" such problems, there is still no definitive answer. I struggled to find a way to display available fonts for a specific frame or check if the injected CSS was applied to that frame.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The slick jQuery plugin seems to be malfunctioning

I recently downloaded the jQuery files in order to implement some image sliders on my website, but unfortunately, they are not functioning properly. Is there anyone who can help me identify any issues with the code? Thank you in advance. <body> ...

Prevent the page from scrolling while the lightbox is open

I am struggling with a lightbox that contains a form. Everything is functioning properly, but I need to find a way to prevent the HTML page from scrolling when the lightbox is active. <a href = "javascript:void(0)" onclick=" document.getElementById(& ...

Adjusting the appearance of a label within an md-input-container using a CSS class

Looking for a way to apply styling to the md-input label inside md-input-container using ng-class. While able to style with inline css, encountering issues when trying to use a css class on the label. Is this expected behavior or am I overlooking somethin ...

Just starting out with CSS and coding. Setting up radio buttons and divs for a simple beginner's gallery

One challenge that perplexes me is how to reposition the concealed divs below the radio buttons with labels. Check out my HTML here View my CSS code here /*color palette: abls [lightest to darkest] #eeeeee #eaffc4 #b6c399 ...

Issues arise with the layout when using Twitter Bootstrap as adding an extra column causes the main menu to be concealed

Having some issues with a Bootstrap 3.0.x template at the moment: You can check out the demo template here: www.kuzma.tk Originally, the layout looked like this: left sidebar: col-md-2 col-md-offset-1 middle component: col-md-6 Right sidebar: ...

Verify whether the value is in the negative range and implement CSS styling in React JS

I have been developing a ReactJS website where I utilize Axios to fetch prices from an API. After successfully implementing this feature, I am now looking for a way to visually indicate if the 24-hour change percentage is positive by showing it in green, a ...

Struggling with Bootstrap 4 Navigation - Placement of Icons Challenge

I'm struggling with aligning the search and shopping cart "icons" on mobile. On desktop, the icons should be positioned to the right of the menu as they currently are. However, I want to move the icons to the left side of the hamburger icon in respon ...

How to center a video horizontally using Bootstrap styling

In my search for a solution, I have not been able to find a way to horizontally center a video within a Bootstrap div or header section while also keeping the video vertically aligned with the top. The div or header section has a 100% width with fixed heig ...

Creating a carousel with three thumbnails arranged in two rows

Currently, I am using a slider for my thumbnails. If you want to check out the code for this thumbnail slider, click on this link: thumbnails slider code My goal is to display 6 thumbnails in total, with 3 thumbnails shown in each row (2 rows total). Add ...

Can you show me where I can find Selenium IDE within Chrome's developer tools?

Just installed the Selenium IDE extension from the Chrome Web Store at this link: https://chrome.google.com/webstore/detail/selenium-ide/mooikfkahbdckldjjndioackbalphokd. However, after opening my developer tools, I can't find the IDE displayed anywhe ...

How can I customize the dropdown list arrow to match my own design?

Is there a simple way to substitute the standard arrow in the dropdown menu with a custom arrow image? ...

Select element from Material UI displaying horizontally

I'm brand new to Material Ui and currently tackling the implementation of their SELECT component. However, I am running into an issue where it is displaying in a row instead of a column. Am I overlooking something important here? const SelectDropDownC ...

Tips for optimizing Slider Code to showcase an expanded selection of slides

I am currently troubleshooting a slider code on my ASP.NET website. After examining the HTML, JS, and CSS from the page theme, I noticed that only two slides are being displayed. However, when attempting to add a new slider HTML and adjusting the CSS for t ...

Drupal 7 FlexSlider - alignment issue with image placement

I am encountering an issue with the Flexslider module on my Drupal 7 website. I have created a simple slider that displays 3 photos. I enabled touch screen functionality for the slider, and everything seems to be working fine except for one problem - all t ...

What is the method to set an element's height equivalent to the height of the entire screen?

I attempted using height: auto;, however, it did not produce the desired outcome. Do you have any suggestions or alternative solutions? ...

The issue with CSS Width:100% not functioning properly in Google Chrome

I am currently working on creating a gallery section that includes captions using the figure and figcaption elements. This gallery must be responsive and adapt to varying heights and widths along with their corresponding captions. While everything is func ...

How can a new <li> element be created without being influenced by certain CSS styles?

I am attempting to enhance my menubar by adding a signup/login item aligned on the right without affecting the other center-aligned items. Essentially, I have an entry named "Login/Sign Up" that should maintain its own unique style while seamlessly blendin ...

Creating a border around a div element using JavaScript

Is there a way to set a border for a div box using JavaScript similar to using border:2px solid #000; in CSS? Can this be done within the following for loop? elements = document.getElementsByClassName("box"); for (var i = 0; i < elements.length; i++) ...

Issue with Bootstrap 3 header display on Firefox browser

I'm facing an issue with coding the header on my website. The header looks fine in Chrome, but it's displaying incorrectly in Firefox. The problem seems to be with the responsiveness of the header, which was coded using Bootstrap 3. Here are som ...

Adjust the display from none to block when the parent element is set to flex

JSFiddle Demo Issue with - .popupcard_first:hover .popupcard_first { display: block; } I am trying to link the :hover effect to the first card only, but the only way I could make it work is by changing .popupcard... to .featured_cards:hover .po ...