Javascript with IE 11 issue - javascript

I have a web application written 15-18 years ago, I am working on asp.net web page which is using obsoleted iframe. the below line of code only works in IE8 and getting objects count =1439, the same line ignores by all other browsers and return null.
Iframe code:
var frame = window.document.all.tooltipFrame;
I resolved this issue by accesing the element and fixed my code behind instead.
Thank you

As you can see from the MSDN documentation. document.all is no longer supported:
[all is no longer supported. Starting with Internet Explorer 11, use getElementById. For info, see Compatibility changes.]

Related

Browser component (IE) does not show values for document.getElementbyId

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.

new Websocket() return wrong object in Firefox Quantum

I'm using Firefox Quantum (64.0) and the JS command new WebSocket() returns a different object from the specification:
MDN Websocket
HTML Standard
The missing property that is affecting my appllication is the .close() function, but there is another differences.
You can see in the image bellow that the returned object has a .websocket porperty that contains all the missing ones.
websocket object
Am I doing something wrong? With older versions of Firefox (before Quantum, like 43) or with chrome it works fine.
If it is a problem with firefox, how can I report it?
EDIT:
Adding some code example:
var exampleSocket = new WebSocket("wss://echo.websocket.org");
exampleSocket.close() // Throw "exampleSocket.close is not a function" in Firefox Quantum, works on chrome
exampleSocket.websocket.close() // Works on Firefox, Throw on chrome.
This exampleSocket.websocket is not in the documentation.
Edit2:
I tested in other machines that have the firefox versions 60, 61, 63 and 64 and the problem only happened in my machine.
When I removed all plugins from firefox it started to work again.
The problem was the websocketsniff plugin that I had installed.
It even state that the WebSocket object will change:
Inspect websocket frames in Firefox. How to use: 1) Open Developer
Tools 2) Open "Websocket Sniffer" tab
This extension replace native websocket object for custom object. It
is dirty hack, but it is single decision

Can I display the IE compatibility version of a HTA inside itself?

So I've got this code that runs inside a HTA...
jsv=ScriptEngine()+' v'
+ScriptEngineMajorVersion()+'.'
+ScriptEngineMinorVersion()+'.'
+ScriptEngineBuildVersion()
It displays the version of JScript the HTA is using.
So... My question is:
Can I display the IE Compatibility Mode version, or similar, of the HTA in the same way?
And if so... How?!
In IE8 and later, you can retrieve document.documentMode. It gives you a number representing the current document mode, 5 for quirks-mode, 6 for IE6 etc.
In IE6-7 there was document.combatMode, which returned a string telling you whether the standards-compliant mode is switched on or not.
Notice, that ScriptEngine returns the latest available JScript version, the used document mode doesn't change the values.

Bug when printing <iframe> in Google Chrome 35

So, I'm getting complains from my users that the print feature of our website is not working anymore. After some investigation, I found out this is a problem specific to the recent version of Chrome (number 35, released May 20th 2014). So the traditional code
window.frames[ "my-iframe" ].focus( )
window.frames[ "my-iframe" ].print( )
is now broken in Google's browser. The error is:
TypeError: object is not a function
Other people are having similar problems (here and here).
It looks like window.frames[ "my-iframe" ] is returning a frameElement instead of the DOM object.
Any solution or workaround to fix this print issue just for Chrome?
Sorry, guys! My bad. I was using "id" instead of "name" inside the iframe. Safari was understanding it anyway, as well as previous versions of Chrome.
Simple solution, apparently.

Method compareDocumentPosition unsupported only in IE9

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

Categories