S
S
strify_252016-08-17 11:35:02
JavaScript
strify_25, 2016-08-17 11:35:02

Why don't conditional comments work?

On the page www.complex-safety.com/contact after "how to get to our office on foot" there should be a Yandex map. But it does not work in ie8, I decided to replace it with a static one. I wrapped the script with the map in a comment, but for some reason the map is not shown in all browsers. Here is the complete code:

<!--[if !(IE 8)]> 	 
<script type="text/javascript" charset="utf-8" src="//api-maps.yandex.ru/services/constructor/1.0/js/?sid=WcrZ7ic6V23Ummldw0a9mbCObyfKl3Bi&width=600&height=450"></script>
 <![endif]-->

What could be the reason?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Eugene, 2016-08-17
@AppFA

For IE8, you need to write like this:

<!--[if !IE 8]><!-->
<script type="text/javascript" charset="utf-8" src="//api-maps.yandex.ru/services/constructor/1.0/js/?sid=WcrZ7ic6V23Ummldw0a9mbCObyfKl3Bi&width=600&height=450"></script>
<!--<![endif]-->

I checked - the script works in all browsers except IE8 (as it should be)

G
GreatRash, 2016-08-17
@GreatRash

Conditional comments were cut out of IE (starting from version 10 in my opinion). You need to rewrite it to be IE8 only, such as hiding the map block in it.

I
Ivan Sergeev, 2016-08-17
@ivan3008

and so? - without brackets:
Is it possible to do this with js?

if (($.browser.msie) && ($.browser.version == '8.0'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question