1
votes

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");
1
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
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
Your HTML page includes the JS framework most likely, that has nothing to do with Visual Studio. - AmigoJack
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

1 Answers

1
votes

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