问题
I have a portlet application that works flawlessly in Firefox and Chrome, but is bombing out in IE 8 and 9, BUT only if I have 5 or more instances of the portlet on the portal page. If there are 4 or less instances of the portlet on the page, it works fine in IE too.
The error I see when I have 5+ instances of the portlet on the page is:
SCRIPT87: Invalid argument. jquery-1.5.2.min.js, line 16 character 25442
The code uses jQuery and a handful of plug-ins, namely jqGrid. Here is what I have tried so far to resolve the issue, none of which has made any difference:
- Upgraded the jQuery and jQuery-UI libraries. The code uses 1.5.2 and 1.7.2 respectively. Upgrading to the latest versions made no difference.
- Upgraded the jqGrid library. The code uses version 4.1.2. Upgrading to 4.3.2 made no difference.
- Upgraded the bgiframe plug-in. The code uses version 2.1. Upgrading to 2.1.3 made no difference.
Because it is IE, it is very difficult to debug to see what is going on.
Has anyone seen this behavior before or have any idea as to what may be going on?
UPDATE:
OK, I have replaced the min versions of the jQuery files with the non-minified ones. Here is the error I see when I have 5+ instances of the portlet on the page in IE 8:
Message: Invalid argument.
Line: 2105
Char: 5
Code: 0
URI: https://nasa-iceint.nasa.gov/portal/ice-theme/js/jquery-1.5.2.js
Here is the pertinent code from the jQuery file:
if ( set ) {
// convert the value to a string (all browsers do this but IE) see #1070
elem.setAttribute( name, "" + value );
}
Any ideas?
回答1:
I figured out what was going wrong here. It turns out that loading a CSS file dynamically in IE when there is already a lot of CSS loaded can cause issues. See Dynamically loading css stylesheet doesn't work on IE
Hopefully this helps someone else down the road who encounters the same issue.
回答2:
Maybe your page is adding a JSON that is not well formed.
var jsonThatWorksOnFirefoxAndChrome = {
first:"ok",
last: "not ok, remove the comma after this string to fix it",
}
Chrome and Firefox will just ignore the final comma.
回答3:
Also check for jQuery conflicts and make sure you include only one version of jQuery and only once.
来源:https://stackoverflow.com/questions/10236280/ie-invalid-argument-with-jquery