In one of my web pages, I am using the following line of JavaScript:
return !!(a.compareDocumentPosition(b) & 16);
However, only in IE9, I am getting the following error:
Object doesn't support property or method 'compareDocumentPosition'
Other browsers work fine. Does anyone know of an available fix or workaround for this?
Internet Explorer supports compareDocumentPosition only in IE9 mode. Make sure you have at the beginning of your markup and document.documentMode returns 9
Related
I am listening to a server event via a javascript function on my HTML file, which outputs the server answer in the console tab. Since I need to pass this answer to a delphi application, I made the server answer "visible" via a div container. This works fine on Firefox, but on IE the output is not shown. I have then tried to utilize the value of a textarea, which also works on Firefox but not on IE.
I really wonder why it is so hard to get a console output visible on IE?
document.getElementById('my_div_container').innerHTML = JSON.stringify(my_data_I_want_to_see, null, 4);
document.getElementById('my_textarea').value = JSON.stringify(my_data_I_want_to_see, null, 4);
The above lines show a result on Firefox, but on IE there is no output at all. How can I get my data visible on IE?
I found the root cause why IE did not show any console output. I just found out, that the addEventListener() method I was using is not supported in Internet Explorer 8 and earlier versions.
I am very sorry for any confusion.
If you are using TWebBrowser component in Delphi for displaying the webpage do note that by default it running in Internet Explorer 7 compatibility mode.
In order to avoid this you need to opt your program into browser emulation feature
How to have Delphi TWebbrowser component running in IE9 mode?
Don't forget to check MSDN documentation for proper registry value to enable emulation of most modern IE versions.
In my JavaScript I have a function detectEnvironmentAndGetLEAndDepot() which is called onload via HTML. I'm working with wicket, and need to take values held in the back-end, so I fire them to the screen, hide them, and search the <span> values from my JS for the name value, for example if(v.getAttribute('name') === 'LE'){do stuff} or if(v.getAttribute('name') === 'depot'){do stuff} (I'm sure not the most elegant solution, but I needed a quick one!). Then within the function detectEnvironmentAndGetLEAndDepot() I do a bit of formatting etc so the data is usable.
detectEnvironmentAndGetLEAndDepot() function (quite long, only relevant part) -
detectEnvironmentAndGetLEAndDepot = function() {
Array.from(document.getElementsByTagName('span')).forEach(function(v) {
//Search name tag for particular names, then do formatting
}
When I open this in IE11 I get the error in a popup SCRIPT438: Object doesn't support property or method 'from' which is related to the first line of the method above - the Array class. Help much appreciated.
As Array.from method is not supported by IE, you can try to use:
[].slice.call(document.getElementsByTagName('span')).forEach(function(v) {});
This doesn't require usage of any 3rd party libraries.
You could use an ES2015 polyfill, like es6-shim, Array.from or Babel polyfill
As explained by Mozilla here, the Array.from function is not yet supported by IE
you can use instead _underscore.js with function _.toArray(document.getElementsByTagName('span'))...
FYI:
'Array.from' not supported in the following document modes: Quirks, Internet
Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer
8 standards, Internet Explorer 9 standards, Internet Explorer 10
standards, Internet Explorer 11 standards. Not supported in Windows
8.1.
source
I'm assuming this is pretty obvious but I can't work it out for myself. I'm using the Facebook javascript API to allow a user to login into a page I made. The following javascript throws the error Object doesnt support this property or method. IE is saying the first line is throwing the error. Anyone know what I'm doing wrong?
document.getElementById('auth-loginlink').addEventListener('click', function () {
FB.login(function (response) {
}, {scope: 'email,user_likes,read_stream'});
The page can be accessed on http://claritytrec.ucd.ie:9000/signup
You're running your page in Quirks -mode. There must not be any characters or blank lines before declaring document type.
Only IE >= 9 knows addEventListener(), use attachEvent() instead with older IEs. attachEvent in MSDN, you can find more information about the legacy eventhandling model of IE by following left-side links at the MSDN page.
The charts are working ok in most browsers, including firefox and Opera. However in IE I am getting:
Object doesn't support this property or method
report_graph.js
Code: 0
URI: http://10.11.4.92:5000/assets/report_graph.js?body=1
It's possible that you're calling the javascript file along with a query-string attached. Check out: Passing Querystring style parameters into Javascript file and Passing parameters to JavaScript files for possible solutions.
It wa all due to a `.trim() at the end of some of the code !
e.g. I had $('some selectors).text().trim()
Changing it to $('some selectors).text().trim() fixed it.
As it actually has worked ok in some browsers this seems to suggest an actual issue with the javascript engine in IE. Either it doesn't support the method that other browsers do... or it does not handle the error as gracefully, causing a runtime exception for a error that other browser ignore.
I am using the latest version of CKEditor (CKEditor 3.6.3, released on 17 April 2012) on my site.
It works perfectly in Firefox, Chrome and IE9 without any modification.
It works perfectly in Firefox and Chrome when I customize the toolbar, but then I get the following error message (I translated it) in IE9:
"SCRIPT5007: Cannot retrieve the value of property length, the object is null or undefined.
ckeditor.js, line 11101 token 21"
And that is the following line:
var w=o.toolbox.toolbars,x=o.config.toolbar instanceof Array ? o.config.toolbar : o.config['toolbar_'+o.config.toolbar];
for(var y=0;y<x.length;y++){
So somehow the variable x is not an Array in IE9: I've tried IE7, 8 and 9 various modes all have the same error.
And it seems that IE9 is also the only browser that does not execute the following line:
CKEDITOR.editorConfig = function( config ) {}
Is this a familiar problem (if so, how can I fix it) or is it a bug in CKEditor?
If your configuration you have a syntax error, for example a trailing comma.