Forum Moderators: open

Message Too Old, No Replies

Disabling javascript for ie6?

         

mr_nabo

10:45 am on Dec 10, 2008 (gmt 0)

10+ Year Member



Hi,

Wondering how to do this as I'm not sure whether it's JQuery (v. 1.2.6-min) or the Lightbox plugin I'm trying to get working (which says it's IE6 compliant) that is causing ie6 to crash.

I've been told that conditional comments to include empty functions for IE6 is the way to do it, but I don't know how to try that out - any ideas?

Thanks

lavazza

11:16 am on Dec 10, 2008 (gmt 0)

10+ Year Member



In IE6:
Tools \ Internet Options
Security tab \ Internet \ Custom Level
Scroll down, down, down, down and then back up a bit, and then down a bit to Active scripting
Click Enable, Disable or Prompt
Click OK \ Yes \ OK

mr_nabo

11:31 am on Dec 10, 2008 (gmt 0)

10+ Year Member



Sorry, I should have been clearer. I need to exclude (not disable) a javascript include from IE6 users as it's crashing the browser.

Thanks anyway - any ideas?

enigma1

11:39 am on Dec 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In the HTML code, use the MS if conditionals for IE eg:

<!--[if lte IE 6]><!-->...........<![endif]-->

lavazza

11:41 am on Dec 10, 2008 (gmt 0)

10+ Year Member



any ideas?

Debug it?

If the relevant section of code ain't too long, post it here

mr_nabo

11:50 am on Dec 10, 2008 (gmt 0)

10+ Year Member



Thanks enigma, but I've tried that and it excludes the code from all the other browsers FF, Safari etc.

I'm not trying to include a specific javascript file for IE6 but rather exclude it as it's crashing the browser.

I'd post the plugin code, but I'm not sure if that would help - it's just the plugin 'jQuery Lightbox Plugin (balupton edition)'. The code I'm using to insert it into my page is:

<script type="text/javascript">
$j(function(){
$j.Lightbox.construct({
show_linkback:false,
download_link:false,
auto_scroll:"follow",
text: {
image:'Photo'
}
});
});
</script>

I can't debug it on IE6 because it crashes before I get the chance and it seems fine using Firebug on a Mac (no errors)

...anything else I can do?

mr_nabo

12:22 pm on Dec 10, 2008 (gmt 0)

10+ Year Member



I should also add that I'm using this on a Joomla site that automatically includes the js library mootools.js plus another plugin that uses swfobject.js.

I'm also using:

var $j = jQuery.noConflict();

So that the Jquery library doesn't conflict with mootools (hence the code with $j above).

However, I've disabled both mootools and swfobject and they don't seem to affect IE6 performance. Only when I remove the Lightbox plugin does IE6 stops crashing.

I'm using the latest (1.2.6) Jquery and don't think there's anything else it could be conflicting with...

mr_nabo

1:30 pm on Dec 10, 2008 (gmt 0)

10+ Year Member



Ok, I've turned on script debugging in IE6, and it's telling me this for most pages:

Line: 3
Char: 2
Error: 'document.getElementById(...)' is null or not an object
Code: 0
URL: [domain.com...]

But for the page that has the Lightbox plugin active, it displays this:

Line: 4
Char: 1
Error: Syntax error
Code: 0
URL: [domain.com...]

However, how can there be a syntax error if it's working fine in IE7 and all other browsers?

This is driving me mad

mr_nabo

8:27 am on Dec 11, 2008 (gmt 0)

10+ Year Member



Seriously, can anyone help me with this? I'll buy you a beer or something...

enigma1

8:51 am on Dec 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



what function makes the call to getElementByID? make sure you do have an ID tag marked inside the HTML element. Also try:

if (document.getElementById) {
somevar = document.getElementById(....);
} else {
// error handling
}

mr_nabo

9:16 am on Dec 11, 2008 (gmt 0)

10+ Year Member



Hi enigma1,

Thanks for all your advice so far (in this thread and others). What's strange, is that in the Lightbox plugin, there's no mention of getElementByID, despite IE6 displaying those error messages when in debug mode.

Could this be a problem IE6 has with the JQuery library itself? In all honesty, I'm really not bothered about IE6 users not being able to use the Lightbox feature as it's not essential to the functioning of my site. However, I do need to exclude the Lightbox Javascript from IE6 if I'm going to use it in other browsers.

This is SO confusing!

mr_nabo

9:49 am on Dec 11, 2008 (gmt 0)

10+ Year Member



I think I've found the problem - it seems there's a conflict between the plugin 'jquery.cycle.lite.js' I'm using and the plugin 'jquery.lightbox.packed.js'. When I remove the first one, there's no problem with the Lightbox plugin, so I guess now the problem is finding out how to get the two to work together.

Hm...