IE8 has been throwing this error at me
SCRIPT65535: Unexpected call to method or property access.
load-scripts.php, line 4 character 25690
I removed a .js file from the code, and the error went away. I started commenting functions out, and narrowed it down to this one. With this one commented, I don't get the error. With it active, I do get it
$("title, .ab-item").each(function() {
var text = $(this).text();
text = text.replace("RepAgent", "Review Scout");
$(this).text(text);
});
I've used JSHint and it says that it's valid?
I'm pretty sure that Internet Explorer doesn't like you messing with <title> element contents. That's not really how you set the document title anyway; just set document.title.
jQuery uses appendChild inside $.text() .
Although <title/> has a appendChild-method(inherited from HTMLElement), this method may not be used.(it's also not listed in the title-methods)
For some reason, I am getting the following Javascript error in Internet Explorer 8 on line 3156 of jquery.js (version 1.4.3, non-compressed version): Object doesn't support this property or method. No error occurs in Firefox and Google Chrome.
This is the line the error occurs on:
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
Investigation (console.log(Expr.leftMatch[type])) produces the following interesting result: In Google Chrome, it outputs
/(^(?:.|\r|\n)*?):((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\3\))?(?![^\[]*\])(?![^\(]*\))/
However in Internet Explorer this is the output:
function() {
var p = this;
do p = p.previousSibling;
while (p && p.nodeType != 1);
return p;
}
On which exec cannot be called (it is undefined). The quoted function is not present within jquery.js. Does anyone have any clue why this happens, or what I can do to solve it?
I have, unfortunately, not yet been able to create a simple script to reproduce the problem, although I did find this post of someone having the same problem, but it does not offer a solution (the last post suggests the page should be run in Standards Mode, but mine already is).
As it turns out, I managed to figure it out by myself after several painful hours. It appears the Sizzle selector engine breaks in this unexpected way (and only in Internet Explorer), if you have defined Object.prototype.previousObject elsewhere.
Removing that declaration, or renaming previousObject to something else fixes the problem.
The funny thing is, I even put that code there myself (the Object.prototype.previousObject = [the function in my question]), but I did not recognize the code.
Well, that's another day full of development potential wasted.
I have discovered the same behaviour occurs if you attempt to add a method called "inherited" to the Object.prototype, ie Object.prototype.inherited = <some func>
It affects IE6, 7 & 8 but seems to be fixed in IE9 (beta)
May be to late to respond but I had the same problem and solved with selecting elements with plain java script rather then jquery!
var div = document.getElementById("myDiv");
var rect = div.getBoundingClientRect();
This works some how!
HI,
I am trying to dynamically add a form to a tab in Ext-js. (the tab has already been rendered). fyi, i am using I am using Ext 2.2.
the error occurs when during the tab.add function:
ie:
function tabactivate(tab) {
var newItem= new Ext.FormPanel(.....);
**tab.add(newItem)**; //ERRORS HERE
tab.doLayout();
}
I get this error on line 247 of ext-all-debug.js
which is
range = el.ownerDocument.createRange();
the error is (Object doesn't support this property or method.)
This works fine in Firefox but breaks in IE8.
Does anyone know a workaround for this ?
Thanks
This sounds very similar to an issue I had with ExtJS 2.2 and IE.
It seems like a lot of places in the Ext code that you see code like this:
var td = document.createElement("td");
this.tr.insertBefore(td, this.tr.childNodes[index]);
When in fact that doesn't work on IE because "this.tr.childNodes([0])" does not yet exist.
My workaround was to override the prototype (in my case insertButton() in Ext.Toolbar) to check for the existence of this.tr.childNodes([0]), using a different function or creating it if it didn't exist.
I hope that I'm correct that this is the problem you are running into.
So i found an old string that had the solution for me.
http://www.extjs.com/forum/showthread.php?t=7912&highlight=createRange
Essentially, when i was instantiating empty tabs, i had my html property set to this:
html: ' ',
once i either took the property out completely or i changed to
html: '<span></span>'
it stopped breaking.
Thanks
IE (even 8) doesn't support the document.createRange() method.
You can try var supportsDOMRanges = document.implementation.hasFeature("Range", "2.0"); to see whether a browser supports DOM ranges per the standard.
I am using this chunk of jQuery/Javascript code on my site to open a popup window:
$('#change_photo_link').click(function(){
$id = $('#id').attr('value');
window.open("photo.upload.php?id=" + $id,"Upload Photo",
"menubar=no,width=430,height=100,toolbar=no");
});
This code works on Firefox and Chrome. It does not work on IE7 or IE8 (haven't tested IE6).
IE pops up an error on the line window.open. Why? The error that IE gives is "Invalid Argument" and that's all.
It's the space in the second parameter that's causing it. If you use "UploadPhoto" instead of "Upload Photo", it works:
$('#change_photo_link').click(function(){
$id = $('#id').attr('value');
window.open("photo.upload.php?id=" + $id,"UploadPhoto",
"menubar=no,width=430,height=100,toolbar=no");
});
I can't seem to find any official reasons as to why having a space in the windowName parameter of window.open() causes an error, but it's likely just an implementation detail. The windowName is used as an internal reference, and can be used as a value for a target attribute of an anchor or form, so I guess IE can't handle that internally. The reference docs for Gecko/Firefox says that this parameter should not contain spaces, but clearly current versions of Gecko don't have a problem with it if it does.
The windowName argument can only contain alphanumeric characters and underscores (i.e. [A-Z0-9_]).
You must change
window.open("photo.upload.php?id=" + $id,"Upload Photo",
"menubar=no,width=430,height=100,toolbar=no");
to
window.open("photo.upload.php?id=" + $id,"Upload_Photo",
"menubar=no,width=430,height=100,toolbar=no");
or some other name that doesn't have spaces.
See https://developer.mozilla.org/En/DOM/Window.open.
I have a site that has an IE8-only problem:
The code is:
var w = window.open(urlstring, wname, wfeatures, 'false');
The error is:
Message: Invalid argument.
Line: 419
Char: 5
Code: 0
URI: http://HOSTNAME/js_context.js
I have confirmed the line number of the code (the "Line" and "URI" are correct), and I understand in later versions of IE8, this is considered accurate.
I have checked all the incoming parameters in the call by dumping alerts, and they all look valid.
This problem does not happen on FF (probably 3).
UPDATE:
The problem appears to be in using assigning the result of window.open() when doing "var w". When I split the line into two statements it works in IE8.
UPDATE2:
Based on:
http://javascript.crockford.com/code.html
When a function is to be invoked
immediately, the entire invocation
expression should be wrapped in parens
so that it is clear that the value
being produced is the result of the
function and not the function itself.
This is not exactly what is going on here, but I found that applying the principle solved the problem, in IE8's compatability mode.
var w = (window.open(urlstring, wname, wfeatures, false));
This is an old posting but maybe still useful for someone.
I had the same error message. In the end the problem was an invalid name for the second argument, i.e., I had a line like:
window.open('/somefile.html', 'a window title', 'width=300');
The problem was 'a window title' as it is not valid. It worked fine with the following line:
window.open('/somefile.html', '', 'width=300');
In fact, reading carefully I realized that Microsoft does not support a name as second argument. When you look at the official documentation page, you see that Microsoft only allows the following arguments, If using that argument at all:
_blank
_media
_parent
_search
_self
_top
IE is picky about the window name argument. It doesn't like spaces, dashes, or other punctuation.
When you call window.open in IE, the second argument (window name) has to be either one of the predefined target strings or a string, which has a form of a valid identifier in JavaScript.
So what works in Firefox: "Job Directory 9463460", does not work in Internet Exploder, and has to be replaced by: "Job_Directory_9463460" for example (no spaces, no minus signs, no dots, it has to be a valid identifier).
the problem might be the wname, try using one of those shown in the link above, i quote:
Optional. String that specifies the
name of the window. This name is used
as the value for the TARGET attribute
on a form or an anchor element.
_blank The sURL is loaded into a new, unnamed window.
_media The url is loaded in the Media Bar in Microsoft Internet
Explorer 6. Microsoft Windows XP
Service Pack 2 (SP2) and later.
This feature is no longer
supported. By default the url is
loaded into a new browser window or
tab.
_parent The sURL is loaded into the current frame's parent. If the frame has no parent, this value acts as the value _self.
_search Disabled in Windows Internet Explorer 7, see Security and Compatibility in Internet Explorer 7 for details. Otherwise, the sURL is opened in the browser's search pane in Internet Explorer 5 or later.
_self The current document is replaced with the specified sURL.
_top sURL replaces any framesets that may be loaded. If there are no framesets defined, this value acts as the value _self.
if using another wname, window.open won't execute...
Actually a name can be used however it cannot have spaces so
window.open("../myPage","MyWindows",...) should work with no problem (window.open).
I also meet this issue while I used the following code:
window.open('test.html','Window title','width=1200,height=800,scrollbars=yes');
but when I delete the blank space of the "Window title" the below code is working:
window.open('test.html','Windowtitle','width=1200,height=800,scrollbars=yes');
Hi using the following code its working...
onclick="window.open('privacy_policy.php','','width=1200,height=800,scrollbars=yes');
Previously i Entered like
onclick="window.open('privacy_policy.php','Window title','width=1200,height=800,scrollbars=yes');
Means Microsoft does not allow you to enter window name it should be blank in window.open function...
Thanks,
Nilesh Pangul
For me the issue was with a dash "-" in the window name field. I removed the dashes and IE does not error out and in fact opens the window.
What does position four represent, the one that has 'false' as an value? Shouldn't that be false, (i.e. without quotes?). It's possible that earlier versions of IE would coerce the string to a boolean, but newer ones don't.
The answers here are correct in that IE does not support spaces when setting the title in window.open(), none seem to offer a workaround.
I removed the title from my window.open call (you can use null or ''), and hten added the following to the page being opened:
<script>document.title = 'My new title';</script>
Not ideal by any means, but this will allow you to set the title to whatever you want in all browsers.
Try remove the last argument. Other than that, make sure urlstring, wname, and wfeatures exist.
I discovered the same problem and after reading the first answer that supposed the problem is caused by the window name, changed it : first to '_blank', which worked fine (both compatibility and regular view), then to the previous value, only minus the space in the value :) - also worked. IMO, the problem (or part of it) is caused by IE being unable to use a normal string value as the wname. Hope this helps if anybody runs into the same problem.
If you want use the name of new window etc posting a form to this window, then the solution, that working in IE, FF, Chrome:
var ret = window.open("", "_blank");
ret.name = "NewFormName";
var myForm = document.createElement("form");
myForm.method="post";
myForm.action = "xyz.php";
myForm.target = "NewFormName";
...
It seems when even using a "valid" custom window name (not _blank, etc.) using window.open to launch a new window, there is still issues. It works fine the first time you click the link, but if you click it again (with the first launched window still up) you receive an "Error: No such interface supported" script debug.