Hello,
ie.css is only loaded when the $is_IE WordPress Global Variable is true …
global $is_IE, $wp_scripts;
if ( $is_IE ) {
// If IE 11 or below, use a flattened stylesheet with static values replacing CSS Variables.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/assets/css/ie.css', array(), wp_get_theme()->get( 'Version' ) );
} else {
// If not IE, use the standard stylesheet.
wp_enqueue_style( 'twenty-twenty-one-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
}
This variable is set in vars.php of WordPress core as follows …
if ( ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false || strpos( $_SERVER['HTTP_USER_AGENT'], 'Trident' ) !== false ) && strpos( $_SERVER['HTTP_USER_AGENT'], 'Win' ) !== false ) {
$is_winIE = true;
} elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE' ) !== false && strpos( $_SERVER['HTTP_USER_AGENT'], 'Mac' ) !== false ) {
$is_macIE = true;
}
As you can see above, because the variable is only set to true when the user’s browser agent contains MSIE, it’s highly unlikely that using Firefox would allow this to happen.
ie.css is used to make sure that the theme is compatible (to a fashion) with Internet Explorer which isn’t compatible with the var() CSS function used throughout the theme’s CSS.
So … it’s more likely that something is messing with the $is_IE global variable on your site. Perhaps another plugin?
Or perhaps you’ve changed the Twenty Twenty-One theme … ? Have you tried with a fresh copy of Twenty Twenty-One?
Oliver
Thanks for that explanation. We haven’t edited the theme. None the less i’ve installed a fresh copy and we’ll see how that goes. Given the irregularity of it all it might be a week before we see it happen
I notice
function twentytwentyone_add_ie_class()
in functions.php on a page i was looking at before i freshened up the theme that had loaded styles from ie.css i didnt see the is_IE body class.
Also could you hazzard a guess as to what type of plugin might do this. I just looked at this list and nothing jumped out at me
Thanks so much Oliver
I notice function twentytwentyone_add_ie_class() in functions.php
That just injects the class is-IE into the body element of the HTML if the JavaScript recognises the user-agent of the browser as containing MSIE.
Just looked at your site though and not seeing ie.css being loaded anymore so looks like you sorted it.
Oliver
Thanks again Oliver well keep an eye onit but that’s the frustrating thing it just seems to randomly load- But perhaps reinstalling the theme sorted it
Oliver could you take another peek. right now the primary menu has the ie styles but not on every page
Most are ok, but not here for example
https://www.walkercreekmedia.com/gloucesterprints/
Hello,
I can confirm that your site is loading ie.css on Safari.
Very odd indeed.
All I can suggest is that you disable all plugins and see which one is causing this issue by turning them back on one-by-one. Obviously make sure you run a full backup before doing this.
I can think of no reason why an unmodified WordPress core or parent theme would cause this behaviour.
Sorry.
Oliver
Are you using any sort of caching plugin, or do you see a “Clear/Purge Cache” button in your Dashboard or admin bar? If so, would you please try clearing the cache?
Note: You do not need to install a caching plugin at this point just to clear a cache you don’t have. If you don’t have a caching plugin or a way to clear a server-level cache, just say so. š
Yes we are James and if I clear the cache it will and did fix this issue- but it or perhaps another one related to ie.css will reappear eventually
Ok, that sounds right then. So, someone with IE visits the site, and that gets cached.
Your caching system shouldn’t be caching variables like that though.
What caching plugin are you using?
James thanks- were using the lightspeed cache
In that case, I recommend reporting the problem at https://wordpress.org/support/plugin/litespeed-cache/ so the plugin’s developers and support community can help you with this.