From 427bf9a2e8b3a0f04ef823da373aaa084bdcc346 Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Fri, 3 Feb 2017 10:52:39 +0100
Subject: [PATCH] do not deliver scripts to ie<9 fixes #1816

All script tags are now surrounded by conditional comments to tell
Internet Explorer 8 and lower to not even bother trying to load the
JavaScript.
---
 inc/template.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/inc/template.php b/inc/template.php
index b8d9fe6a1..605714f12 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -445,6 +445,9 @@ function tpl_metaheaders($alt = true) {
  */
 function _tpl_metaheaders_action($data) {
     foreach($data as $tag => $inst) {
+        if($tag == 'script') {
+            echo "<!--[if gte IE 9]><!-->\n"; // no scripts for old IE
+        }
         foreach($inst as $attr) {
             echo '<', $tag, ' ', buildAttributes($attr);
             if(isset($attr['_data']) || $tag == 'script') {
@@ -459,6 +462,9 @@ function _tpl_metaheaders_action($data) {
             }
             echo "\n";
         }
+        if($tag == 'script') {
+            echo "<!--<![endif]-->\n";
+        }
     }
 }
 
-- 
GitLab