pedalpete
pedalpete

Reputation: 21536

javascript loading conditional statement

I've been struggling for days with getting rid of an error in IE, and to 'almost' no avail.

I just tried loading jquery 1.2.6 instead of 1.3.2, and the error has gone away (though the site is noticeably slower now).

However, I suspect I may be stuck with this solution. Is there a browser based way to include the script similar to the css conditional statements?

I can do it serverside if I need to, but client-side would be nice.

Upvotes: 0

Views: 1814

Answers (1)

Ken Browning
Ken Browning

Reputation: 29091

You can use Conditional Comments to include script only for IE.

<!--[if IE]>
    <script type="text/javascript">
        /*  Do Stuff */
    </script>
<![endif]-->

To exclude a script block from IE:

<![if !IE]>
    <script type="text/javascript">
        /*  Do Stuff */
    </script>
<![endif]>

Upvotes: 3

Related Questions