Skip to content

Commit

Permalink
do not deliver scripts to ie<9 fixes #1816
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
splitbrain committed Feb 3, 2017
1 parent 65a6bb0 commit 427bf9a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions inc/template.php
Expand Up @@ -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') {
Expand All @@ -459,6 +462,9 @@ function _tpl_metaheaders_action($data) {
}
echo "\n";
}
if($tag == 'script') {
echo "<!--<![endif]-->\n";
}
}
}

Expand Down

0 comments on commit 427bf9a

Please sign in to comment.