Jump to:

23493 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Best way to include scripts with conditions like <!--[if lt IE 7 ]>..

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 534 Views
  • vwd
    Avatar
    Community Member
    158 Posts

    Best way to include scripts with conditions like <!--[if lt IE 7 ]>.. Link to this post

    Hi,

    What is the best way to include scripts such as:

    <!--[if lt IE 7 ]>
    <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
    <script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script>
    <![endif]-->

    At the moment, it seems that the only way is to stick it in the template....

    If I use Requirements::customScript, it wraps everything in <script></script> such as below:

    <script type="text/javascript">
    //<![CDATA[
    <!--[if lt IE 7 ]>
    <script src="//ajax.googleapis.com/ajax/libs/chrome-frame/1.0.2/CFInstall.min.js"></script>
    <script>window.attachEvent("onload",function(){CFInstall.check({mode:"overlay"})})</script>
    <![endif]-->
    //]]>
    </script>

    Any ideas?

    Thanks very much.
    VWD

    534 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.