Can we add javascript to IE conditional comment just before </body>

This code should put this code at the bottom of the body in a conditional comment.

<!--[if lt IE 7]> <script src="http://ie7-js.googlecode.com/svn/version/2.1(beta2)/IE7.js"></script> <![endif]--> 
+4
source share
4 answers

The conditional comments use the syntax of normal comments: <!-- [if …]>…<![endif] --> . This is why browsers that don’t understand them ignore them. Thus, they can be placed wherever normal comments are allowed. And the script element is allowed to be children of the body .

So, you can put this conditional comment below in your body element.

+3
source

Yes. Conditional comments do not have to be in the main tag.

http://msdn.microsoft.com/en-us/library/ms537512(VS.85).aspx

+1
source

You can put this code in the <head> tag and it will work.

But he can go anywhere.

0
source
  <!--[if lte Gecko 3.1]><script type="text/javascript"> Cufon.replace('.cufonised p, H2'); </script> <![endif]--> 

Could this work?

0
source

Source: https://habr.com/ru/post/1303322/


All Articles