?
Solved

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

Posted on 2011-09-23
4
Medium Priority
?
320 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 9

Accepted Solution

by:
user_n earned 2000 total points
ID: 36591295
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
ID: 36591308
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
ID: 36592736
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
ID: 36592752
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Find out what you should include to make the best professional email signature for your organization.
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…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
Suggested Courses

765 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