MIME type ('text/html') is not a supported - any wordpress plugin available to fix this?

MIME type ('text/html') is not a supported - any wordpress plugin available to fix this?
Refused to apply style from 'https://www.example.com.au/register/' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

I'm seeing the following error in the browser console on my WordPress site:

Refused to apply style from 'https://www.example.com.au/register/' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. This error suggests that a CSS tag is trying to load a page URL (/register/) instead of a valid .css file, and the browser refuses to apply it due to the incorrect MIME type.

πŸ” What I've Checked: I'm not directly linking /register/ as a stylesheet in my code.

I reviewed my theme and plugin files, and found no tags pointing to /register/.

I have a custom PHP file that handles the /register/ page (shortcode and script enqueueing), but it doesn't enqueue any CSS directly:

wp_enqueue_script( ERE_PLUGIN_PREFIX . 'register' ); I also enqueue a JS file in my child theme like this:

function child_theme_enqueue_scripts() { wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/assets/js/swap-dev.js', array('jquery'), '1.0', true); } add_action('wp_enqueue_scripts', 'child_theme_enqueue_scripts'); Everything here seems normal and not pointing to /register/ as a stylesheet.

βœ… What I Tried: Inspected the page source and looked at all <link rel="stylesheet" ...> tags β€” trying to find one pointing to /register/ (no luck).

Checked browser developer tools > Network tab β€” filtered by css to find what stylesheet is being loaded from /register/.

Directly opened Read more β€” it returns an HTML page (as expected), not a CSS file.

❓ What I Need Help With: How can I:

Locate the faulty tag or function that’s injecting a page URL as a CSS file?

Track down where this might be coming from (theme, plugin, page builder, etc.) if I can't find it in the template or theme files?

Know if this could be related to a plugin misconfiguration or page builder custom CSS?

πŸ™ Any ideas on how to debug this deeper or trace which part of my site is injecting that bad stylesheet link would be greatly appreciated!

Answer

It looks like the stylesheet loaded from javascript (or maybe iframe - if exists).

To reproduce the source loaded, you can do the following:

  1. Open Inspector > Network
  2. Click Filter Box and type example.com (or what ever the problem url error occured)
  3. Force Reload the page (ctrl + shift + r)
  4. Select the filtered with url example.com, click / select, and the right section will appear, and then select the initiator.

You could find what caused css to loaded as is and trace it

Enjoyed this article?

Check out more content on our blog or follow us on social media.

Browse more articles