Why is Chrome ignoring IE conditional tag?

Talk nerdy to me

I'm using a custom bootstrap wordpress theme.

My head is created as per Bootstrap recommendations

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php wp_title( '|', true, 'right' ); ?></title>
<link rel="profile" href="http://gmpg.org/xfn/11" />
<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
<?php // Loads HTML5 JavaScript file to add support for HTML5 elements in older IE versions. ?>
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<?php wp_head(); ?>
</head>

I may be misunderstanding the signifigance of the IE condtional tag, but I expected the IE hack code to only load in IE, however all of these scripts are present in Chrome.

Am I misusing this tag? Is there another recommended way of making sure these scripts only load for IE browsers lighter than version 9?

I prefer to keep my pages as light as possible, so I don't want unnecessary code loading just to appease the silly few still using ie8 and below.

user2428118

--> ends a comment. So, the end of this comment:

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->

is also the end of the part that is a comment to the Chrome rendering engine.

The solution is easy: just move your comment tags outside of the IE conditional.

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Why is Chrome ignoring IE conditional tag?

From Dev

Why is IE11 Ignoring Conditional Comment

From Dev

IE Conditional Comment in XSLT 1.0 inside tag

From Dev

IE Conditional Comment in XSLT 1.0 inside tag

From Dev

Why is Chrome ignoring /etc/hosts on OS X?

From Dev

HTML IE conditional statement: Not working with Chrome/Firefox

From Dev

Conditional stylesheets from Chrome-IE compatibility

From Dev

IE conditional content showing up on chrome mobile

From Dev

CSS: Why Is Chrome (on Linux) Ignoring My Font-Family?

From Dev

Ansible ignoring conditional

From Dev

Ansible ignoring conditional

From Dev

Why does this highchart plot not render in IE or chrome?

From Dev

Why MHTML not browsed by chrome/Firefox but with IE?

From Dev

Why is this working differently in Firefox, Chrome and IE?

From Dev

Why is this animation working in IE 11 and Edge but not in chrome?

From Dev

Why does Chrome use the IE settings for connection?

From Dev

Why margin issue in IE and Chrome but not in firefox?

From Dev

Why does this highchart plot not render in IE or chrome?

From Dev

Why is this working differently in Firefox, Chrome and IE?

From Dev

Why is this animation working in IE 11 and Edge but not in chrome?

From Dev

Ignoring style for a concrete tag

From Dev

Ignoring style for a concrete tag

From Dev

Why is Chrome loading my HTML in a "pre" tag?

From Dev

Why does IE9 on emulation mode render conditional comments?

From Dev

Why My Conditional Tag Didn't work in Wordpress

From Dev

Chrome ignoring hashes in URL

From Dev

Chrome notification ignoring eventTime

From Dev

Chrome Ignoring Host File

From Dev

Chrome Ignoring autocomplete='off'

Related Related

HotTag

Archive