Jump to content
Registration disabled at the moment Read more... ×
softtouch

Detect if WebView2 Runtime is installed

Recommended Posts

Is there any way to detect that the webview2 runtime is installed on the target system?

Share this post


Link to post

I did asked myself today the same question and did made a different approach and would like to know what you think about it?

On the form with the TWebBrowser that has its SelectedEngine property set to "EdgeIfAvailable" I put in FormShow event:

WebBrowser.Navigate('about:blank');

For the WebBrowser I did created an Event for "OnNavigateBefore2" with the following content:

  if string(URL) = string('about:blank') then
    if WebBrowser.ActiveEngine <> Edge then
      begin
        // here I let my form display a message that Edge Runtime is missing and a button to open the official download site
      end;

For me it worked and now I searched for other solutions and found this thread.

(I was aware of the Registry Key but that does not ensure if user might has deleted the WebView2Loader.dll...)

Share this post


Link to post

From my experience, this is sufficient:

	TWebBrowserHelper = class helper for TWebBrowser
		function getIsUsingEdge(): Boolean;
	end;
    
function TWebBrowserHelper.getIsUsingEdge(): Boolean;
begin
	Result := Assigned(GetEdgeInterface());
end;

 

Share this post


Link to post

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×