I made a template in HTML5 which is working with Chrome and Firefox but not working with Internet Explorer (tested on IE 8).
How can I solve this problem?
I made a template in HTML5 which is working with Chrome and Firefox but not working with Internet Explorer (tested on IE 8).
How can I solve this problem?
just add "display:none" to your templates. Works for i.e. 11
You can hide the element using CSS:
template { display:none !important; }
And if you need to access/clone the content like natively possible in other browsers, use this polyfill: https://github.com/jeffcarp/template-polyfill
I recommend you Neovov's polyfill: https://github.com/neovov/template-element-polyfill
NB: There's a bug in IE 11: it moves <template> under the <body> element before rendering the DOM! So the parentNode attribute is wrong, and nesting will fail. You can see it in the [F12] Tool.
You are searching for the html5shiv.
It 'enables' all the html5 elements, which aren't available in the old internet explorer versions.
Get a copy of html4shiv, and use it where IE is less than 9:
You can try to replace
<template>
tag by<script>