1

I wrote two programs. One on Delphi 2009, another on Visual Studio 2019 to view the same html page. I used the twebbrowser component (or webbrowser control). In both cases, clicking the button on the page in window of webbrowser does not work and the corresponding java script does not execute. The page displays a message that my browser is out of date. Attempts to press a button programmatically failed (nothing happens, there is no error either). But the button work in the Internet Explorer 11. The code of the button:

<div id="showAll" class="showAllClass block" onclick="showAll(1, this)">
  <a href="javascript:void(0);">Show all</a>
</div>

The code for Delphi:

var
  A : IHTMLElement3;
  doc : IHTMLDocument3;
  v   : OleVariant;
begin
  A := (MyWebbrowser.Document as IHTMLDocument3).getElementById('showAll') as IHTMLElement3;
  v:=Unassigned;
  (A as IHTMLElement3).FireEvent('onclick',v);
end;

The code for C#:

webBrowser1.Document.GetElementById("showAll").InvokeMember("onclick");
Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19
SQLprog
  • 357
  • 1
  • 3
  • 11
  • `div` is not a button. `The page displays a message that my browser is out of date` surely comes from the JavaScript framework you use but never named. Likewise nobody knows how `showAll` is defined. – AmigoJack Aug 08 '19 at 11:16
  • I think it's not important. On the page, this code looks like a button. How to view a JavaScript framework for VS 2019? – SQLprog Aug 08 '19 at 11:23
  • Your HTML page includes the JS framework most likely, that has nothing to do with Visual Studio. – AmigoJack Aug 13 '19 at 10:33
  • The webbrowser of VS runs java scripts on its side. And when you wrote about the java framework, I thought that it was about supporting certain java functions. But you most likely write about the framework on which the script is written. – SQLprog Aug 13 '19 at 11:23

1 Answers1

1

I found answer here How can I get the WebBrowser control to show modern contents? as addition of

"YourApplicationFileName.exe"=dword:00002af9
"YourApplicationFileName.vshost.exe"=dword:00002af9

to Registry by path

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
SQLprog
  • 357
  • 1
  • 3
  • 11
  • That links to a question, not one of its answers. If you mean https://stackoverflow.com/a/38514446/4299358 then it also tells me/you that your HTML document is not well formed (missing DOCTYPE). You surely have other problems, too, and what you practice here is called https://en.wikipedia.org/wiki/Shotgun_debugging – AmigoJack Aug 13 '19 at 14:54