...

View Full Version : Block IE from loading javascript



rhinodog8
08-25-2008, 08:29 AM
I know how to get IE to load a certain javascript and block all other browsers but how do I get IE to stop loading another javascript file that other browsers need to read.

I'm looking for a simple code that can be put into the javascript that needs to be blocked by IE

Philip M
08-25-2008, 08:59 AM
This is called conditional compilation.

See:-

http://www.javascriptkit.com/javatutors/conditionalcompile.shtml


rnd me is entirely corrrect. I guess that I misunderstood the question.
When the OP said "I know how to get IE to load a certain javascript and block all other browsers"
I understood this to mean that he was already familiar with conditional comments. As indeed it seems he was.



Lottery: A tax on people who are bad at math.

rnd me
08-25-2008, 09:10 AM
for a whole file, conditional comments are a lot simpler.
plus, conditional compilation prevents compilation of your code, and forces packaging to be done by hand. most compressors for instance, throw away comments, breaking your IE version...



<![if !IE]><script src="myExternalJS.js"></script><![endif]>

rhinodog8
08-25-2008, 09:24 AM
hmm... wierd I was using conditional comments but they didn't work for anything other than IE, but I copied yours and it worked, Guess I was writing it wrong. THANKS!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum