IE9 jQuery load order issue - javascript

I have a page that is quite jQuery reliant.
The functionality on the page works fine in all browsers, except IE9.
This I understand is down to the issue with IE9 where Javascript can load very slowly.
The problem I face is that the page, once loaded thinks that Javascript is not available.
An error I am seeing in the console is:
SCRIPT5007: Unable to get property 'length' of undefined or null reference
File: jquery-1.8.3.min.js, Line: 2, Column: 14331
For the record, the jQuery lib is loaded before any other js files.
I have tried to get around this issue by adding the following code into the head, to try and force IE9 into IE8 mode. Note by default for IE we force 'edge' mode.
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!--[if IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
<![endif]-->
However, this makes no difference.
Before anyone asks why we're relying on IE9, it is a business requirement.
Does anyone have any idea how I can get the page to render in IE8 mode if the bowser accessing the page is IE9?
Many thanks in advance.
I should add, the page in question has a 'noscript' check on it, so will not render if JS is not available. This is true ONLY in IE9. For all other browsers, the page will render fine.
I'm wondering if the above error is something else...
For the record, I have been looking at this IE9 JavaScript error: SCRIPT5007: Unable to get value of the property 'ui': object is null or undefined thread.

As I understand it, this is an issue with jQuery under IE9, which was fixed at some point after jQuery 1.8.3.
So the issue can, in all probability, be fixed by using a later version of jQuery.
At this time, I would opt for jQuery 1.11.0. Don't be tempted by the 2.x series, which deliberately omits lots of backward compatibility stuff.
Unfortunately, this will mean requalifying everything that uses jQuery, which is a pain.

OUr issue was down to IE not recognising the 'console' command.
As we were running a number of console.log commands, when this part of the code was reached in IE9, it stopped, and prevented any other JS from loading.
So the fix we have implemented is: If console not defined (IE9), define an empty object literal
if(!(window.console && console.log)) {
console = {
log: function(){},
debug: function(){},
info: function(){},
warn: function(){},
error: function(){}
};
}
This seems to be working for us now. :)

Related

IE 11 showing error when i clicking with jquery function

IE so much confusing me with some errors like this,
SCRIPT1002: Syntax error
File: jquery-2.1.4.min.js, Line:2 Column 2538
The weird thing is , on firefox and chrome running well and no error.
And some button with jquery click function is working.
I'm Using IE 11
Before this i'm using jquery-1.1.13.min.js and when i use jquery 2.0 it still running properly on firefox and chrome
I'm really new with cross browser so any info will helping me very much, thanks :)
For the record I had this error which only showed itself on IE when doing cross-browser testing of a big Javascript code change.
In my case the problem was a function definition which included what would be a default in any other language:
i.e. Function Foo(param1, param2, param3=false)
.. clearly this was a stupid bit of code .. but it took me a while to track down so this might help someone out there. Doesn't show up in Chrome, FF, or even Edge.
Mostly these errors are not problems of jQuery itself. The problem situates in code using jQuery or inserted into jQuery (callbacks or event functionalities). In my case I used $.ajax to load a remote page in a div element. In the page I loaded there where // comment tags in the javascript part. As IE is putting this content on one line, more code that as I wanted was commented and this created the error.
So if in our case us are using $.ajax maybe this can be an issue. Otherwise best thing to do is debugging the code that generates this error and look for code that is not supported by IE (the version you use). Look for functions passed trough to jQuery.

Postback with HTML Editor Extender on page causes JavaScript error in IE11

I have added an HTML Editor Extender to the page I'm working on and now ANYTIME I cause a post back on the page I get the following Javascript error:
JavaScript runtime error: Invalid argument.
And nothing happens after that. This works fine in IE10 or below and all other browsers that I'm aware of, however it does not work in IE11 which I need it to work in. Does anyone know of any fixes for this issue?
It looks like it's a known issue with the AjaxToolKit.
Try inserting this below the head tag:
<meta http-equiv="X-UA-Compatible" content="IE=10,chrome=1" />

Unable to get property 'replace' of undefined - only in IE9

I only receive this error in Internet Explorer 9. IE7, IE8 and IE10 run the script fine. It is a banner of fading images, one after the other all stacked and fade in to each other.
When you attempt to load the page on IE9, it throws an error. The error occurs within prototype.js and I get this error.
SCRIPT5007: Unable to get property 'replace' of undefined or null reference
prototype.js, line 334 character 24
Why would this happen in IE9 but not any earlier version??
I was getting the same error message, because I was using a .html() operation on an XML tag.
var myXML = '<someTag att1=""><cell></cell></someTag>' ;
$(myXML).html(); // which was giving the error msg.
// Instead use the below option
$(myXML).children() ;// instead this work with IE
Note: Above example is not what I actually tried, it's just to give a representation of the problem.
You should try using the X-UA-Compatible tag. Many libraries do not work well with IE9 and need to be run in IE8 compatible mode.
<meta http-equiv="X-UA-Compatible" content="IE=8" />
I've resolved the issue after a few hours of hair pulling and teeth grinding.
I did not realize that scriptaculous was reliant upon prototype.
I was updating prototype while leaving an outdated version of scriptaculous effects linked which was throwing many errors.
After updating to scriptaculous 1.9 and then updating prototype to 1.7, all was well and no errors are thrown.
Thank you all to those who helped, I appreciate all the comments!
Well, most of the time this error occures because of the .html() operation in jquery to parse XML. Remove this and use .text() instead will solve the problem.

Jquery Error in ie8 and ie9 with Wordpress theme. (Object doesnt support this property or method)

I recently launched a website for a client http://www.bridgechurch.us/ only to recieve complaints of it not displaying correctly on ie8 or ie9. I have confirmed this to be true. IE is pointing to this line of Javascript:
jQuery(function () {
jQuery(".scrollable").scrollable({circular: true}).navigator().autoscroll({interval: 7000});
[...]
Can anyone help me figure out what is wrong with this line of code?
Thank you
UPDATE - FIXED
I figured out that there was a comment before the Doctype Declaration that forced IE into quirks mode.
You have a lot of 404's on that page, mainly related to ie-specific css and border images, which is probably why the page doesn't look like it should. Files like /images/internet_explorer/borderBottomRight.png and /wp-content/themes/Moses/styles/default.css aren't loading.
That being said, looking at the scrollable documentation, there is no .navigator() function off of the return value of scrollable(); and I'm getting the same error in Chrome.
Well, visually, the site doesn't appear to work well at all in IE9 (compared to Chrome). But just looking at the code that adds scrollable() to jQuery, you can see that that function doesn't always return the original element. In your code, if you split the call into two, you might be ok:
jQuery(".scrollable").scrollable({circular: true});
jQuery(".scrollable").navigator().autoscroll({interval: 7000});
I blame the plug-in on this one: functions that extend jQuery are supposed to always return the original elements found by the selector.

Javascript error for ie9 - flickrshow gallery

I have a page with two flickrshow galleries on it. They both work fine in FF, Chrome, Safari, ie6+ but not ie9. I am fixing various js problems by using
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" />
to emulate ie8. Problem is that there is still an error for the js and ie is throwing up the 'webpage error, do you want to debug' message each load.
Using the Debugger, error is:
SCRIPT5007: Unable to get value of the property 'removeChild': object is null or undefined
flickrshow-7.2.min.js, line 11 character 4468
The line of the flickrshow js that gets highlighted with the error on:
a.elements.script.parentNode.removeChild(a.elements.script)
Suggestions please, thanks
Since you haven't given much context for your code. Try logging a.elements.script.parentNode and a.elements.script and a to see if you actually are getting the elements your expecting. From the error I assume since it has something to do with IE not getting the HTML element correctly. However, it could be something with a I'm assuming it is a variable for something, but I'm not sure what.

Categories

Resources