Solved

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

Posted on 2011-09-23
4
315 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mobile page Scrolling down when refreshing 4 61
If condition on Html with Asp 11 27
Make options hidden and show just option that is on 1 28
Asp in script 6 35
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

792 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