0

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?

Mr. Ajin
  • 325
  • 1
  • 3
  • 16
  • 1
    Please specify what you mean with the "console output" that is not shown in IE. The code you typed just updates two DOM elements' contents, but where is the `console.log` part? – SparkFountain Sep 05 '19 at 08:11
  • 1
    At first sight, Delphi can send/receive ajax calls just like javascript. Maybe look into that so you can do a POST request to your delphi app instead of this workaround. – Shilly Sep 05 '19 at 08:16
  • With your above code, we are not able to produce the issue or even not getting any idea about the cause for the issue. You said that you are listening an event. So try to debug your code and make sure that event got executed properly than verify that above code getting executed. Let us know, if there is any error or warning message in console. If possible than please try to provide an example which can use to make a test with IE may help us to understand the issue in better way. Thanks for your understanding. – Deepak-MSFT Sep 05 '19 at 08:28

2 Answers2

0

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.

Mr. Ajin
  • 325
  • 1
  • 3
  • 16
  • Thanks for posting the solution for this issue. I suggest you to try to mark your own answer as an accepted answer for this question after 48 hrs, when it is available to mark. It can help other community members in future in similar kind of issues. Thanks for your understanding. – Deepak-MSFT Sep 05 '19 at 08:42
0

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.

SilverWarior
  • 7,372
  • 2
  • 16
  • 22