Solved

IE Conditional Statement to disable a specific script (IE8 only)

Posted on 2011-09-23
4
309 Views
Last Modified: 2012-05-12
I'm a complete newbie/rookie in web design, but I have come across an issue for one of my sites that I'm currently designing. I saw that 2 similar questions were posted on stackoverflow (one being spot on), but I wasn't able to discern the answer...probably because I'm not very advanced.

I want to know...is there a way to disable a specific script within an IE8-only conditional statement?

Let me explain: I have a rounded corner script that works absolutely beautifully in Firefox, Safari, and IE9. However in IE8, if the background of the parent div is an image (which they all are in this case), the rounded corners fail to appear transparent and instead show as annoying little white fill. (My site is http://gkplusjm.com)

I was able to find some great CSS code that I could implement for IE8, and I have successfully done so in a ie8.css file through a IE conditional statement. I know it works because when I removed the corner script completely and viewed the page with the ie8.css, it was acceptable enough for my liking. However, I put the script back in so it would function on all other browsers, and the problem reared its head again. So what I really need is to find a way to disable that script, but only if the viewer is using IE8. Seems simple enough, but I can't find the fix. Some of the codes I have tried include:

<!--[if lt IE 9]>
<script src="scripts/jquery.corner.js" type="text/javascript"></script>
<![endif]-->

and also this:

<!--[if !(IE 8)]><!-->
<script src="scripts/jquery.corner.js"></script>
<script>
    // your inline script goes here
</script>
<!--<![endif]-->

Option #2 seemed to have worked for the other person who posted this question, but I couldn't figure out what to put in the part that reads "your inline script goes here" to make this disable work.

Any advice is appreciated.

Many thanks!
0
Comment
Question by:imakepunch
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
user_n earned 500 total points
Comment Utility
The script that makes problems in ie8 and works in all other browsers is placed on the place of  " // your inline script goes here"
0
 
LVL 13

Expert Comment

by:khairil
Comment Utility
Hi,

You might want to have a look on this, http://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx
There also example in there.
0
 

Author Comment

by:imakepunch
Comment Utility
thanks for the great/quick response.

user_n: i think i'm following you, but not sure that i'm implementing it correctly (since i tried it and  i still have the problem). the external script that is giving me the issue is called "jquery.corner.js". this is the script i want to disable in IE8, so i have targeted that in the first part. .

the script that i wrote which activates that is not inline in my HTML...i have in a separate external file i created called "script.js" which i linked in my HTML source code. i believe that is what i am supposed to enter in the "//your inline script goes here"?

i copied and pasted that script code and this is what it looks like in my HTML source code (but still having the issue in IE8):


<!--[if !(gte IE 8)]><!-->
    <script src="scripts/jquery.corner.js"></script>
    <script>
            $(document).ready(function(){            
                  $('li.gkplusjm').corner("right");
                  $('li.engagement-ring').corner("right");
                  $('li.proposal').corner("right");
                  $('li.ceremony').corner("right");
                  $('li.accommodations').corner("right");
                  $('li.music').corner("right");
                  $('li.travel').corner("right");      
                  $('li.cabo').corner("right");
                  $('li.registry').corner("right");
                  $('li.reception').corner("right");
                  $('li.blog').corner("right");
                  $('a').corner("right");
                  $('#page-content').corner("25px");
                  $('#footer').corner("top 25px");
            });    
      </script>
<!--<![endif]-->
0
 

Author Comment

by:imakepunch
Comment Utility
oh wait...nevermind. i was able to fix it with both of your responses...THANK YOU!

i didn't realize that the conditional statement i was using was for all browsers EXCEPT IE8...so i was pasting my script in there, but still had it activated outside of the conditional statement. i simply deleted it from the original code, and placed the following:

<!--[if !IE 8]><!-->
            <script src="scripts/jquery.corner.js" type="text/javascript"></script>
<!--<![endif]-->

that took care of it!

thanks so much to you both! :)
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now